How to use dig command?

dig (domain information groper) is a network administration command used for network troubleshooting purpose.

dig <type> <domain or ip>

How to search for all A records for the domain?

Using dig command you can find all A records for the given domain or ip address using following syntax:

# show long output
dig A

# show shor output only IP Address
dig +short A


Following table can be used to find different A types:

Type Purpose Example
A IPv4 IP address dig A
AAAA IPv6 IP address dig AAAA
CNAME Canonical name record (Alias) i.e. cname dig CNAME
MX Email server host names dig MX
NS Name (DNS) server names dig NS
PTR Pointer to a canonical name. dig  PTR
SOA Authoritative information about a DNS zone dig  SOA
TXT Text record dig  TXT