Name

dig

Synopsis

dig [@server] [options] [name] [type] [class] [query-options]
dig @server name type
dig -h

TCP/IP command. The dig command is used to query DNS servers; it is more flexible than the deprecated nslookup command. When invoked with just the -h option, it displays a list of options for the command. If you use it without any options or arguments, it will search for the root server. The standard arguments are:

server

The server to query. If no server is supplied, dig will check the nameservers listed in /etc/resolv.conf. The address may be an IPv4 dotted address or an IPv6 colon-delimited address. It may also be a hostname, which dig will resolve (through the nameservers in /etc/resolv.conf).

name

The domain name to look up.

type

The type of query to perform, such as A, ANY, MX, SIG, and so forth. The default is A, but you may use any valid BIND9 query type.

Options

You may use the following option flags with dig:

-b address

Set the source IP address for the query.

-c class

Set the class of query. The default value is IN (internet), but you can choose HS for Hesiod or CH for CHAOSNET.

-f filename

Operate in batch mode, performing the queries in the file you specify.

-k filename

Specify a TSIG keyfile; used for signed transactions. You can also use the -y key, although this is less secure.

-p portnumber

Choose the port number for the query. The default value is the standard DNS port, 53.

-q name

Specify domain name to query. Sometimes this is needed to distinguish the domain name from other ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.