Terminal Dojo
Help العربية Sign inGet started

Command library / dig

dig

BashDraft — pending expert review4 practice missions

Query DNS records for a domain

dig (Domain Information Groper) sends a DNS query and prints the answer. The domain name comes first; the record type (A, MX, NS, TXT…) is an optional second word — dig recognises it by matching known type names, not by a flag. `+short` trims the output to just the answer, and `@server` sends the query to a specific DNS server instead of your default resolver.

Practice dig

Usage

dig [@server] name [type]
dig +short name

Options and flags

Examples

Common mistakes

dig mx example.com dig example.com MX

The name comes before the type, not after — dig reads left to right and the type is recognised by keyword, wherever it lands, but conventional order is name then type.

Related commands

nslookuptraceroute