dig Command
The dig (Domain Information Groper) command is a flexible tool for interrogating DNS name servers. It is commonly used for network troubleshooting and DNS diagnostics.
Querying for Record Types
You can ask for specific types of DNS records. If no type is specified, dig defaults to querying for an A record.
Get IPv4 Address (A Record)
dig google.comPerforms a standard lookup for the A record (IPv4 address) of a domain.
Get IPv6 Address (AAAA Record)
dig google.com AAAAQueries for the AAAA record (IPv6 address).
Get Mail Servers (MX Record)
dig google.com MXQueries for MX (Mail Exchange) records, which direct email for the domain.
Get Text Records (TXT Record)
dig google.com TXTQueries for TXT records, often used for domain verification (e.g., SPF, DKIM).
Advanced Usage
Query a Specific DNS Server
dig @8.8.8.8 google.com Queries a specific DNS server instead of your system's default. Here, it queries Google's public DNS server (8.8.8.8). This is useful for checking if a DNS issue is local or widespread.
Get a Short Answer
dig +short google.comProvides a concise answer, showing only the IP address or the relevant record data without the extra diagnostic information.