← All languages
$_
Bash command of the day
Random

dig

Perform DNS lookups.

Description

The dig command (Domain Information Groper) is a flexible tool for querying DNS name servers. It performs DNS lookups and displays the answers returned by the name server.

By default, dig queries for A records. The record type can be specified as an argument (e.g., MX, AAAA, NS, TXT). The +short option produces a concise answer, and @server directs the query to a specific DNS server.

dig is widely used by system administrators for troubleshooting DNS problems, verifying DNS configuration, and checking record propagation. Its detailed output makes it preferred over older tools like nslookup.

Arguments

NameDescriptionOptional
name The domain name to look up. No
type The DNS record type to query (A, AAAA, MX, NS, TXT, CNAME, etc.). Yes
@server The DNS server to query. Yes
+short Display a terse answer. Yes
+trace Trace the delegation path from the root name servers. Yes

Example

dig example.com
dig example.com MX
dig @8.8.8.8 example.com
dig +short example.com AAAA
dig +trace example.com