dig command
Query DNS records.
- Networking
- Package dnsutils / bind-utils
- 6 options · 8 examples
Syntax
dig [@server] name [type] [options]Provided by the dnsutils / bind-utils package. Run man dig for the full manual.
Common options
| Option | What it does |
|---|---|
@SERVER | Ask this DNS server |
TYPE | Record type: A, AAAA, MX, TXT, NS, CNAME… |
+short | Only the answer |
-x IP | Reverse lookup |
+trace | Follow the delegation from the root |
+noall +answer | Only the answer section |
Examples
A record
dig example.comShort answer only
dig +short example.comMX records
dig example.com MX +shortTXT records (SPF, DKIM)
dig example.com TXTAsk a specific DNS server
dig @1.1.1.1 example.comReverse lookup
dig -x 8.8.8.8 +shortName servers
dig example.com NS +shortTrace the resolution
dig +trace example.com
No example matches. Check the options table or search the guides.
dig guides
- 10 Practical Examples of nslookup for Troubleshooting DNS Issues Linux Commands · Updated Apr 2025
- dig Command in Linux with Real-World Scenarios Linux Commands · Updated Apr 2025
- 15 Practical examples of dig command for DNS troubleshooting Linux Commands · Updated Apr 2025
