dig is used on Linux, UNIX or Macintosh system to perform manual DNS lookups. dig performs the same basic task as nslookup, but with one major distinction: The dig command does not have an interactive mode and instead uses only command-line switches to customize results.

dig is generally considered a more powerful tool than nslookup, but in the course of a typical network administrator's day, the minor limitations of nslookup are unlikely to be too much of a factor. Instead, dig is often simply the tool of choice for DNS information and troubleshooting on UNIX, Linux, or Macintosh systems. Like nslookup, dig can be used to perform simple name resolution requests. The output from this process can be seen in the following listing:

; <<>> DiG 8.2 <<>>
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0
;;, type = A, class = IN
;; ANSWER SECTION:        7h33m IN A
;; AUTHORITY SECTION:        7h33m IN NS        7h33m IN NS
;; Total query time: 78 msec
;; FROM: localhost.localdomain to SERVER: default --
;; WHEN: Sat Oct 16 20:21:24 2004
;; MSG SIZE  sent: 30  rcvd: 103

As you can see, dig provides a number of pieces of information in the basic outputmore so than nslookup. There are three key areas of the output from which network administrators can gain information. These are the 'Answer Section,' the 'Authority Section,' and the last four lines of the output.

The Answer Section of the output provides the name of the domain or host being resolved, along with its IP address. The A in the results line indicates the record type that is being resolved.

The Authority Section provides information on the authoritative DNS servers for the domain against which the resolution request was performed. This information can be useful in determining whether the correct DNS servers are considered authoritative for a domain.

The last four lines of the output show how long the name resolution request took to process and the IP address of the DNS server that performed the resolution. It also shows the date and time of the request, as well as the size of the packets sent and received.