Network

The dig command

Queries DNS servers and shows the full answer: IP address, servers and timings.

Syntax

dig dominio [+short]

Most useful options

+shortOnly the answer, ideal for scripts
@servidorUses a specific DNS server

Copy-ready examples

$ dig miguelacm.es +shortDomain IP

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • If you use a different DNS server, the answer can vary due to caching.

Related commands

FAQ

How does it differ from ping?

dig only asks for the address; ping also sends packets.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course