Dig Cheatsheet

  • Lookup A record (default):
dig <domain> 
  • Lookup specific record types
dig <domain> [options]

Options are the query types :

  1. AAAA
  2. MX
  3. NS
  4. TXT
  5. SOA
  6. SRV
  7. CNAME
  8. ANY
  • Query a specific DNS Server
dig @[Server IP] [domain] [query]

Example : dig @8.8.8.8 example.com A , dig @8.8.8.8 example.com mx

  • Useful flags/Output controls
- +short //print only concise answers (IPs, records).

- +noall +answer //suppress everything except answer section.

- +nocmd //hide the command and header.

- +ttlunits // show TTL with time units.

- +multiline //long records nicely.

- +noquestion / +noauthority / +noadditional //hide sections.

- +comments / +cmd //show query comments and command line used.

Example: dig +noall +answer example.com MX
  • Zone Transfer
dig AXFR @[Nameserver] [Domain] 

Example : dig @ns1.example.com example.com AXFR