James R. Williams

Sometimes you need to fetch domain information on a domain to debug hosting/SSL etc. You can always use services such as MXToolbox to do this, however, there are a number of ways you can fetch domain information via the command-line. Here are a few commands you can use to do that.


The dig command is a tool for querying DNS nameservers for information about host addresses, mail exchanges, nameservers, and related information.

dig google.com any


host is a simple utility for performing DNS look ups. It is normally used to convert names to IP addresses and vice versa. The -t option is used below select the query type, for example, mx for MX records and A records for, you guessed it, A records.

Get the a records for a domain: host -t a google.com

Get the a records for a domain:

host -t mx google.com

Get the name server records for a domain:

host -t ns google.com

Replace the -t flag with -a to get all of it in one go:

host -a google.com


whois searches for an object in a WHOIS database. WHOIS is a query and response protocol that is widely used for querying databases that store the registered users of an Internet resource. For example, a domain name or an IP address block but is also used for a wider range of other information.

whois google.com

The -H flag here hides the legal disclaimers some registries like to show you