Top 12 Examples of Linux dig Command
Dig (domain information groper) command is used to get information about the domain name server (dns). This command is very popular among network administrators and Linux users because of its vast functionality and ease of use. This tool is readily available for Linux (Unix) or Macintosh OS X operating systems. Here I am listing examples that will help you better understand the capability and functionality of the dig command.
(1) Basic query to extract information of dns servers
(2) To resolve only the IP of test url
#dig allabouttesting.org +short
(3) To extract information of dns MX records of test url. Mail exchanger (MX) records of a domain name tell the routing of email with SMTP.
#dig allabouttesting.org MX
(4) To extract the information of IP by doing a reverse lookup
#dig -x 188.8.131.52
(5) Use IPv4 or IPv6 transport
#dig -4 google.com #dig -6 google.com
(6) To print all options available
(7) To see all dns records available with the test domain. Results contain different records, including A, AAAA, TXT, MX, and NS.
#dig test-domain.com any
(8) To hide all the output of the executed command. Basically, this command is used to control the print output.
#dig allabouttesting.org +noall
(9) To print only stats such as query time, server information, message size etc. of the test domain.
#dig allabouttesting.org +noall +stats
(10) To print only resolve IP of test domain.
#dig allabouttesting.org +noall +answer
(11) To extract SOA records of the test domain. A start of authority (SOA) record signifies the information stored in a dns zone about that zone and about other dns records.
#dig allabouttesting.org SOA
(12) Query MX type of records from the specific name server.
#dig @184.108.40.206 google.com MX
We have seen top 12 examples of linux dig command which helped you in understanding the concept of dns servers.
Subscribe us to receive more such articles updates in your email.
If you have any questions, feel free to ask in the comments section below. Nothing gives me greater joy than helping my readers!
Disclaimer: This tutorial is for educational purpose only. Individual is solely responsible for any illegal act.