dig
Retrieve Domain Name System information of a server..
Cheatsheet
dig [server] [name] [type]
Command Line Options
+short: Display a terse answer+nocomments: Turn off comment lines+nocmd: Hide the initial comment lines+noquestion: Hide the question section of the output+noauthority: Hide the authority section+noadditional: Hide the additional section+nostats: Hide the stats section at the end
Common Query Types
- A: IPv4 address
- AAAA: IPv6 address
- MX: Mail exchanger
- NS: Name server
- TXT: Text records
- SOA: Start of authority
- CNAME: Canonical name
Examples
Basic query
dig example.com
Query a specific record type
dig example.com MX
Query a specific nameserver
dig @8.8.8.8 example.com
Reverse DNS lookup
dig -x 192.0.2.1
Trace DNS resolution path
dig +trace example.com
Get a short answer
dig +short example.com
Query all record types
dig example.com ANY
Check DNS propagation
dig @ns1.example.com example.com
Get SOA record
dig example.com SOA
Use TCP instead of UDP
dig +tcp example.com