man.lsPlain-English help for Unix commands

dig Look up DNS records

Asks a DNS server for the records of a domain name and prints the full answer. Use it to see where a name points, check mail settings, or find out whether a DNS change has taken effect. Use +short when you only want the answer.

Synopsis

dig [@server] name [type] [+option]...

Common options

Option or formWhat it does
+shortPrint only the answer values, one per line, with none of the surrounding detail
@serverAsk this DNS server instead of your default one, for example @8.8.8.8
-t TYPERecord type to look up, such as A, AAAA, MX, TXT, NS or CNAME. You can also write the type after the name
-x ADDRESSReverse lookup: find the name for an IP address
-p PORTQuery a DNS server on PORT instead of 53
+traceFollow the lookup from the root servers down, to see where it goes wrong
+noall +answerHide everything except the answer section, keeping the TTL and record type

Examples

Look up the address of a name
dig example.com
Just the answer
dig +short example.com
Mail servers for a domain
dig +short MX example.com
Ask a specific DNS server
dig @192.0.2.53 example.com A
Text records, such as SPF
dig example.com TXT +noall +answer
Find the name for an address
dig -x 192.0.2.10 +short

Notes

See also

Last reviewed 2026-10-07.