The dig
command in Linux is a powerful DNS (Domain Name System) lookup tool that is used to query DNS servers for information about domain names, IP addresses, and other DNS records. It is often used by system administrators and network engineers to troubleshoot DNS issues and verify DNS configurations.
Here are some examples of how to use the dig
command:
- Look up the IP address of a domain name:
$ dig google.com
This command will query a DNS server for the IP address of thegoogle.com
domain name and return the results.
- Look up the MX (mail exchange) records for a domain:
$ dig example.com MX
This command will query a DNS server for the MX records for theexample.com
domain name and return the results.
- Look up the DNS records for a domain name with a specific DNS server:
$ dig @8.8.8.8 example.com
This command will query the DNS server at IP address8.8.8.8
for the DNS records for theexample.com
domain name and return the results.
The dig
command can also be used to query for other types of DNS records, such as A (address), AAAA (IPv6 address), NS (name server), and TXT (text) records. It can also be used to perform reverse DNS lookups and to test DNS servers for DNSSEC (DNS Security Extensions) support.
In summary, the dig
command is a powerful tool for querying DNS servers and retrieving DNS records, and it is an essential tool for troubleshooting DNS issues on a Linux system.