Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux dig command

Query DNS records and inspect the response returned by a DNS server.

BIND utilities

Syntax

Command form
dig [@SERVER] NAME [TYPE] [QUERY-OPTIONS]

Common options

6 options
OptionWhat it does
@SERVERSend the query to a chosen DNS server.
A / AAAA / MX / NSQuery common record types.
+shortPrint a concise answer section.
+traceFollow delegation from the DNS root.
+noall +answerShow only answer records.
-x ADDRESSPerform a reverse lookup for an address.

Usage examples

3 examples

Query DNS records and inspect the response returned by a DNS server.

dig example.com

Query IPv4 address records and print concise results.

dig example.com A +short

Request the reverse DNS name for an address.

dig -x 192.0.2.10

Notes

DNS answers can be cached and may differ by resolver, network and time. dig reports DNS data; it does not prove a service is reachable.