dig – DNS lookup utility -perform hostname lookups



dig [ @server ] [ -b address ] [ -c class ] [ -f filename] [ -k filename ] [ -p port# ] [ -t type ] [ -x addr ] [ -yname:key ] [ name ] [ type ] [ class ] [ queryopt ]

dig [ -h ]

dig [ global-queryopt ] [ query ]


dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. Most DNS administrators use dig to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output. Other lookup tools tend to have less functionality than dig.

Although dig is normally used with command-line arguments, it also has a batch mode of operation for reading lookup requests from a file. A brief summary of its command-line arguments and options is printed when the -h option is given. Unlike earlier versions, the BIND9 implementation of dig allows multiple lookups to be issued from the command line.

Unless it is told to query a specific name server, dig will try each of the servers listed in/etc/resolv.conf.

When no command line arguments or options are given, will perform an NS query for “.” (the root).


A typical invocation of dig looks like:

 dig @server name type


is the name or IP address of the name server to query. This can be an IPv4 address in dotted-decimal notation or an IPv6 address in colon-delimited notation. When the supplied server argument is a hostname, dig resolves that name before querying that name server. If no server argument is provided, dig consults /etc/resolv.conf and queries the name servers listed there. The reply from the name server that responds is displayed.
is the name of the resource record that is to be looked up.
indicates what type of query is required — ANY, A, MX, SIG, etc. type can be any valid query type. If no type argument is supplied, dig will perform a lookup for an A record.