Fetch domain information in the command line
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.
dig
The dig
command is a tool for querying DNS nameservers for information about host addresses, mail exchanges, nameservers, and related information.
host
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:
Get the name server records for a domain:
Replace the -t
flag with -a
to get all of it in one go:
whois
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.
The -H
flag here hides the legal disclaimers some registries like to show you