Skip to content

dig

14 commands

The go-to DNS lookup tool: query any record type, pick the server, attempt zone transfers and trace resolution from the root — essential for recon.

  • DNS
  • recon
  • enumeration

Install dig

sudo apt install dnsutils

Basic lookups5

dig <domain>

Queries the A records for a domain with full detail.

Link
dig <domain> +short

Just the answer, ideal for scripts.

Link
dig <domain> <type>

Queries a specific record type: A, AAAA, MX, NS, TXT, SOA, CNAME, SRV, CAA, PTR.

Link
dig <domain> ANY

Asks for all record types (many servers now refuse or minimise this).

Link
dig @<server> <domain>

Queries a specific DNS server instead of your resolver.

Link

Recon6

dig <domain> NS +short

The authoritative name servers — the first step before a zone transfer attempt.

Link
dig <domain> TXT +short

TXT records, which hold SPF, DKIM, DMARC and verification tokens that can leak services in use.

Link
dig -x <ip> +short

Reverse lookup: the PTR record for an IP.

Link
dig axfr <domain> @<ns>

Attempts a zone transfer; a misconfigured server dumps every record — a classic finding.

Link
dig <domain> +trace

Traces resolution from the root servers down, showing the full delegation path.

Link
dig CAA <domain> +short

Which certificate authorities are allowed to issue for the domain.

Link

Troubleshooting3

dig <domain> +noall +answer

Prints only the answer section.

Link
dig <domain> +dnssec

Requests DNSSEC records (RRSIG) to check signing.

Link
dig +nssearch <domain>

Queries each authoritative server for the SOA to spot inconsistencies.

Link