Network
dig
DNS lookup utility for querying name servers.
Synopsis
syntax
dig [@SERVER] NAME [TYPE] [OPTION]...
Examples
Query A record for domain
dig example.com
Get just the IP address
dig +short example.com
Query mail server records
dig MX example.com
Query using Google DNS
dig @8.8.8.8 example.com
Trace full DNS delegation path
dig +trace example.com
Common options
| Flag | Description |
|---|---|
| +short | Terse output — just the answer |
| +noall +answer | Show only answer section |
| -t | Query type (A, AAAA, MX, NS, TXT, etc) |
| @ | Specify DNS server to query |
| +trace | Trace the delegation path |
About dig
The `dig` command dNS lookup utility for querying name servers. Networking commands handle connectivity testing, DNS resolution, data transfer, remote access, firewall rules, and traffic analysis.
Linux is the dominant server operating system, and strong networking skills are essential for web hosting, container orchestration, security auditing, and infrastructure management. The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man dig`).
The 5 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Network Commands
Other commands in the Network category