Host command explained

What is Host command?

The Host command is a tool with a command-line interface for Domain Name System lookups. You can use it straight from the Terminal application since it is usually pre-installed on Linux-based and Unix-based OSes. You can use it on Ubuntu, CentOS, macOS, or others, without any difference in syntax or functionality?

Who created the command?

The Host command was created by the Internet Systems Consortium (ISC), and it offers the Host command under the ISC license, which is a permissive free software license similar to the BSD one.

Purpose of the Host command

You can use the command for:

  • DNS probing and see information about a particular domain name.
  • Find the IP address or IP addresses of a host. Both IPv4 and IPv6 can be seen.
  • Do reverse DNS lookups and see to whom does an IP address belongs.
  • Check DNS records like SOA, A, AAAA, CNAME, MX, and NS.

How to use the command?

For macOS users

You can easily start using the command on macOS:

  1. Press the Command+Space buttons, and you will see a search bar.
  2. Write Terminal, and you will see the Terminal app. Open it.
  3. Now, you can use it by typing “host domain.com”, “host IP address” or use the command with some additional option like “host -t DNSrecordType domain.com”. See the options below for more precise probing.

For Linux users

The command is available through the Terminal application (Linux Shell):

  1. Press Ctrl+Alt+T on Ubuntu or Alt+F2 for another Linux distro.
  2. Inside the Terminal, you can use different hosts commands like “host domain.com”, “host IP address” or use the command with some additional option like “host -t DNSrecordType domain.com”. See the options below for more precise probing.

Host command options

We have shortlisted the list of options available for the Host command, but if you want to see the complete one, just type “host” in your Terminal application and see the full list.

It will also show you the command’s syntax.

OptionDescription
-aThe “-a” stands for all types of DNS records. It is the same as “-t ANY”.
-iThe “-i” is used for Reverse DNS probes. You can also use it directly with only an IP address.
-RUDP packets retry number.
-tWith “-t”, you can set the type of DNS record you want to see, like mx for MX record, ns for NS, and so on.
-TTCP/IP mode.
-wWait without a time limit for queries.
-WWait a set time in seconds for queries.
-4IPv4.
-6IPv6.

Host command examples

If you want to use these examples, please go ahead, but change the IP addresses or domain names with the right ones for your needs.

Host command exmaplesDescription
host site.comShows the IPv4 and IPv6 of site.com (A and AAAA records)
host -t ns site.comShows the NS records for the domain.
host -t cname site.comShows the CNAME records.
host -t txt site.comShows the TXT records.
host -t mx site.comShows the MX records.
host -a site.comShows all DNS records.
host -i 111.333.666.1111Reverse lookup and check which the host is.
Host site.com ns2.site.comChecks the ns2 (the second name server) of site.com

Alternatives to Host command

There are many alternatives to the Host command, and some of the most popular are:

  • Nslookup command is extremely easy to use, and it is available not only on Linux or macOS but also on Windows. Great, always on the hand tool.
  • Dig command – Some people prefer it over the Host command. It has a lot of extra options, and you can use it to see all types of DNS records.
  • Ping command – A limit functionality network tool for checking host. You can ping a host or IP address and see how it responds—no chance to see different DNS record types with it.

Check the different software available and learn to use it. It is always useful to have a DNS probing tool on hand if you own different sites.