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.

Top 12 Examples of Linux dig Command

(1) Basic query to extract information from DNS servers

#dig allabouttesting.org

(2) To resolve only the IP of the test URL

#dig allabouttesting.org +short

(3) To extract information on 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 172.217.167.14

(5) Use IPv4 or IPv6 transport

#dig -4 google.com

#dig -6 google.com

(6) To print all options available

#dig -h

(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 the resolved IP of the 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 @8.8.8.8 google.com MX

Conclusion

We have seen the top 12 examples of Linux dig commands 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.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

10 Blockchain Security Vulnerabilities OWASP API Top 10 - 2023 7 Facts You Should Know About WormGPT OWASP Top 10 for Large Language Models (LLMs) Applications Top 10 Blockchain Security Issues