As we all know, each and every computer has a respective address, put by TCP/IP in a form of numbers. Format is like Computer address is popularly known as IP Address. Every computer in the world has their own and unique IP Address. With the growth of TCP/IP, it becomes difficult to remember addresses of all the computers in such a compact format. So, to resolve this issue, DNS came. DNS, simply translate the IP Address to a name and similarly, name to IP Address. As names are easy to remember by human beings, rather than IP Addresses, so DNS has gained popularity all over the globe. In Linux, some built-in utility are available. In reference to the above, Linux Host command is covered in this article.

About Host Command

Host, a necessary and easy to use command line tool, used to search the IP Address of a given domain name and to print the domain name for the IP Address given. Host command is also a DNS lookup utility. If there are no options or arguments given, command line options and arguments are summarised in a short form, and same is printed by the host.
Here name refers to the domain name which is required to be looked up. Maybe it is a colon-delimited IPv6 address or a dotted-decimal IPv4 address, and in which case, a reverse lookup for that address is performed by host, by default. Here Server is counted as an argument, which is optional, and it is either the IP address of the name server or its name which is queried by the host rather than server or servers which are listed in /etc/resolv.conf.

Uses or Purpose of Host Command

·1 Primary purpose of Host command is to translate a domain or host name into IP Address and vice versa.
·2 To perform DNS name lookups.
·3 To search or find the IP address of a host and vice versa.
·4 To list different kinds of DNS resource records and validate them like MX and NS names.
·5 To verify the connectivity to web and ISP DNS server.
·6 To check the spam and records of blacklisting.
·7 To verify issues related to DNS Server and troubleshoot the same.

Syntax of Host Command

The Syntax is
·1 host [-aCdlnrTwv] domain-name/ipaddress
·2 host [-aCdlnrsTwv] [-c class] [-N ndots] [-R number] [-t type] [-W wait] [-m flag] [-4] [-6] {name} [server]

Examples of Host Command

Here come several examples of Host Command:
·1 How to find the IP Address of a hostname
Suppose a hostname is host is the address of
Now in order to determine the IP Address of a hostname, hostname must be typed along with the host command. IP Address of is
·2 How SOA record information is printed:
host -C
Nameserver SOA
2007062001 86400 7200 3600000 86400 Nameserver SOA
2007062001 86400 7200 3600000 86400
Host's nameserver and its SOA record is printed by the given cmd.

Options of Linux Host command

No. of options are available for host command on Linux OS and here comes a short summary of the relevant ones only. Otherwise, a list is long.
Option Purpose
-a For the given hostname, all their DNS records are printed.
-C Authoritative name servers and SOA records are printed by this option.
-d It is equivalent to -v.
-l By using AXFR, all hosts are listed in a domain.
-t This option is used for choosing the query type. Query Type can be NS, KEY, CNAME, SOA etc.
-W It determines the time or duration of wait for a reply.
-v Host generates the Verbose output.
-T To query the nameserver, rather than UDP, TCP must be used. And this is given in those queries which need TCP, like AXFR requests.