Dig Command Overview
Dig command is used to gather information about host addresses, mail exchange servers, name servers by sending query to the DNS Name server. This tool can be run by Linux or Mac OS. Simply this works with single domain name, to get the result of multiple domain you will have to run multiple queries.
Dig Command Options
To see the available options used to dig command, Open terminal and execute the following command
#dig -h
Dig Usage Instructions
#dig authority www.google.com
in the above command, the result indicates that the authoritative search went from ns2->ns1->ns4->ns3, that means name server 2 have more authority over the search according to the context of the domain name over name server 1.
Now lets fool around with some other commands
#dig nssearch www.facebook.com **searches for name servers**
dig additional www.facebook.com **controls all additional queries **
dig nsid www.facebook.com ** searches for the name servers ID**
Similarly , there are other options that can be used for several other purposes. Here we go folks yet another command prominent in information gathering.
What can I find using the dig command?
dig will let you perform any valid DNS query, the most common of which are:
- A (the IP address),
- TXT (text annotations),
- MX (mail exchanges), and
- NS nameservers.
Use the following command to get the addresses for mt-example.com.
dig mt-example.com A +noall +answer
Use the following command to get a list of all the mailservers for mt-example.com.
dig mt-example.com MX +noall +answer
Use the following command to get a list of authoritative DNS servers for mt-example.com.
dig mt-example.com NS +noall +answer
Use the following command to get a list of all the above in one set of results.
dig mt-example.com ANY +noall +answer
Use the following command to query using a specific nameserver.
dig @ns1.mediatemple.net mt-example.com
Use the following to trace the path taken.
dig mt-example.com +trace
Sources:mediatempleCyberpedia.in