The dig
command, short for “Domain Information Groper,” is a powerful tool used for querying DNS (Domain Name System) records. It allows users to retrieve various types of DNS information, including A records, MX records, and more, making it essential for network troubleshooting and domain management.
The basic syntax of the dig
command is as follows:
dig [options] [arguments]
@server
: Specify a DNS server to query (e.g., @8.8.8.8
for Google DNS).-t type
: Specify the type of DNS record to query (e.g., A
, MX
, TXT
).+short
: Display a simplified output with only the answer.+trace
: Follow the delegation path from the root DNS servers to the queried domain.Here are some practical examples of using the dig
command:
dig example.com
dig -t MX example.com
dig @8.8.8.8 example.com
dig +short example.com
dig +trace example.com
+short
option for quick lookups when you only need the answer without additional details.+trace
option can help identify where the resolution is failing.