Linux host Command Explained for Beginners (8 Examples)

Host command is a simple utility for performing DNS lookups in Linux. With this command, we can translate names into IP Addresses and vice versa.

Here in the article I will show you some examples of using host command in Linux system.

1) Run host command without any options

To use host command just type host and the target address. Let say you want to know the address of We can type :

$ host
Host with no options

But we may have a different result. Take a look at the picture below.

$ host
Another result of host output

We see that is an alias for another address. The last line which has an IP Address is the original address.

As mentioned before, host can also translate an IP Address into a name.

$ host
Reverse output

2) Display SOA record

When we use -C option, we tell the host to display SOA (Start of Authority) record from the domain name.

$ host -C

As we see above, has SOA record which placed in 3 different DNS servers.

3) Specify the query

DNS is built from some records. Some of the records are SOA, CNAME, NS, A, MX, etc. When we want to query specific record, we can use -t option. Here’s some examples.

$ host -t CNAME
CNAME query
$ host -t NS
NS query
$ host -t MX
MX query

4) Force host to query using IP version 4 transport only

By default, host will use IP version 4 and IP version 6 to query a target host. To force only use IP version 4, we can use -4 option.

$ host -4
IP ver 4 query only

5) Force host to query using IP version 6 transport only

If we want to tell host command to query using IP version 6 only, we can use -6 option.

$ host -6

Unfortunately, at the time this article is written, there is not yet a native IPv6 DNS root server. At the present time the DNS implementations available all run on top of IPv4, and the DNS system supporting IPv6 is linked to IPv4 information. So if we push to use -6 option, we will get this message.

IP ver 6 query

6) Print in list mode

With -l option, we can make host perform a zone transfer for zone name. This will will print NS, PTR and address records.

$ host -l
Print in list mode

If we combine it with -a option, it will print all records.

Host using -la options

7) Print information in verbose output

Verbose output will print all information about the target host. This information is similar with -a option below. Another option that similar with -a option is -d option.

8) Reveal all detail about the address

We can use -a parameter to reveal more detail about the specific address.

$ host -a
Display detail information

Here’s how to read the information :

Question Section ; inform us that the Host command ask everything
Answer Section ; inform us that the address of is
Authority Section ; inform us that has 3 responsible DNS. NS means Name Server
Additional Section ; inform us the addresses of the three DNS above

-a parameter is equivalent with -v for verbose output and -t ANY for specifies the query type.

As usual, we can always type man host or host --help to explore more detail about host command usage.

1 thought on “Linux host Command Explained for Beginners (8 Examples)”... add one

Leave a Comment