Terminal: Performing DNS lookup for a domain

Question

How do I perform DNS lookup for a domain name?

Answer

The host command reads the DNS and returns the A, AAAA and MX records belonging to a name. This information is very useful at the start of a debugging session:

host openprovider.com

If the name is a redirect (CNAME) to another name, it will return the information for that other name. For example, www.openprovider.com is a redirect to openprovider.com:

host www.openprovider.com

If you want to see all record types, add the parameter -a:

host -a openprovider.com
Was this article helpful?
2 out of 2 found this helpful
Additional questions? Submit a request