dig

Set defaults

You can use .digrc and store the same command line options in there to use as defaults.

Here, query Google's DNS server for lookups:

@8.8.8.8

Enable short output for all commands:

+short
Lookup DNS records using nameservers

You should see similar results for a DNS lookup, using the different nameservers.

dig site.example.com @ns1.example.com
dig site.example.com @ns2.example.com
Find the MX mail records
dig mx example.com

See also dnsmx, which provides less verbosity.

Find the TXT records

Can be used to display SPF entries.

dig txt example.com

See also dnstxt.

Check if DNS records match

Look for the serial numbers:

dig soa example.com @ns1.example.com
dig soa example.com @ns2.example.com
Find the TTL for a domain
dig +nocmd domain.com +noall +answer
domain.com.	86353	IN	A	1.2.3.4

The first number is the TTL. You can divide it by 360 to see how many hours are left.

Find all the records
dig ANY domain.com
Minimize output
dig ANY +noall +answer domain.com
Reverse DNS lookups
dig -x 208.111.40.179