Skip to content

dig command

Query DNS records.

  • Networking
  • Package dnsutils / bind-utils
  • 6 options · 8 examples
On this page

Syntax

dig [@server] name [type] [options]

Provided by the dnsutils / bind-utils package. Run man dig for the full manual.

Common options

OptionWhat it does
@SERVERAsk this DNS server
TYPERecord type: A, AAAA, MX, TXT, NS, CNAME…
+shortOnly the answer
-x IPReverse lookup
+traceFollow the delegation from the root
+noall +answerOnly the answer section

Examples

  1. A record

    dig example.com
  2. Short answer only

    dig +short example.com
  3. MX records

    dig example.com MX +short
  4. TXT records (SPF, DKIM)

    dig example.com TXT
  5. Ask a specific DNS server

    dig @1.1.1.1 example.com
  6. Reverse lookup

    dig -x 8.8.8.8 +short
  7. Name servers

    dig example.com NS +short
  8. Trace the resolution

    dig +trace example.com

dig guides

← All Linux commands · Suggest a fix

Back to top