Privacy Policy
© 2025 linux101.dev

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.com

Performs a standard lookup for the A record (IPv4 address) of a domain.

Get IPv6 Address (AAAA Record)

dig google.com AAAA

Queries for the AAAA record (IPv6 address).

Get Mail Servers (MX Record)

dig google.com MX

Queries for MX (Mail Exchange) records, which direct email for the domain.

Get Text Records (TXT Record)

dig google.com TXT

Queries 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.com

Provides a concise answer, showing only the IP address or the relevant record data without the extra diagnostic information.