dig commands

11 commands, each with a one-line explanation. Click a command to copy it, or click its title to see details.

Commands 11 shown

  • dig +noall +answer example.com

    Hide headers and stats and print only the answer. Good for scripts and diffs

    dns · troubleshooting

  • dig +nssearch example.com

    Query each authoritative NS directly. Shows if their SOA serials differ

    dns · troubleshooting

  • dig axfr @ns1.example.com example.com

    Dumps the whole zone if AXFR is open. Note: if this works on a public NS, it is a misconfiguration

    dns · security

  • dig +dnssec +multi example.com @1.1.1.1

    Show RRSIG records. The AD flag in the flags line means the answer was validated

    dns · dnssec · security

  • dig +trace +nodnssec example.com

    Follow delegation from the root to the authoritative server and hide RRSIG/DS records

    dns · troubleshooting

  • diff <(dig +short @1.1.1.1 example.com) <(dig +short @8.8.8.8 example.com)

    Find split-horizon setups or stale cache differences between resolvers

    dns · troubleshooting · debug

  • dig -x 2606:4700:4700::1111 +short

    Get the PTR record for an IPv6 address. -x builds the reversed nibble name for you

    dns · network

  • for r in example.com _dmarc.example.com sel._domainkey.example.com; do dig +short TXT $r; done

    Get SPF, DMARC and DKIM TXT records in one loop for a mail audit

    dns · security

  • dig +short CAA example.com

    Show which CAs may issue certificates. With no CAA record, any CA can issue

    dns · tls · security

  • dig +short SRV _sip._tcp.example.com

    Get priority, weight, port and target for a service. AD, SIP and XMPP use these records

    dns · network

  • dig +tcp +ttlunits +noall +answer example.com @8.8.8.8

    Check that TCP/53 works. +ttlunits prints TTL as 1h or 30m instead of raw seconds

    dns · network · troubleshooting