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

# show shor output only IP Address
dig +short google.com A

Output:

Following table can be used to find different A types:

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