The dig
command in Linux and Unix is used to query the Domain Name System (DNS) to retrieve information about hostnames, IP addresses, and other DNS-related information. The dig
command can be used to perform various types of DNS lookups, such as checking the A (address) record for a hostname, the MX (mail exchange) record for a domain, or the NS (name server) record for a domain.
Here are some examples of how to use the dig
command:
- Perform a basic DNS lookup:
dig example.com
- Display the A record for a hostname:
dig example.com A
- Display the MX record for a domain:
dig example.com MX
- Display the NS record for a domain:
dig example.com NS
- Display the reverse DNS lookup for an IP address:
dig -x IP_ADDRESS
- Display the authoritative name servers for a domain:
dig example.com NS +auth
- Display the additional information for a DNS lookup:
dig example.com +trace