host Linux Commands

What is Linux host Command?

Explanation

host COMMAND:

host command is used to find the ip address of the given domain name and also prints the domain name for the given ip.

SYNTAX :


host [-aCdlnrTwv] domain-name/ipaddress

OPTIONS:


-a Prints all the DNS records for the given hostname.
-C Prints the SOA records and authorative name servers.
-d It is equivalent to -v.
-l Lists all hosts in a domain using AXFR.
-t used to select the query type.
Query Type: CNAME,NS,SOA,KEY etc,.
-W Specifies how long to wait for a reply.
-v Verbose output is generated by host.
-T Use TCP instead of UDP to query nameserver. This is implied in queries that require TCP, such as AXFR requests.

EXAMPLE:


  1. To find the ipaddress of a hostname
    host 123456789.co.in
    123456789.co.in has address 69.65.102.222

    By typing the hostname along with the host command you can get its ipaddress. The ip address of 123456789.co.in is 69.65.102.222
  2. To Print SOA record information:
    host -C 123456789.co.in
    Nameserver ns1.dnshorizon.com:
    123456789.co.in SOA ns1.dnshorizon.com. saisan.gmail.com.
    2007062001 86400 7200 3600000 86400 Nameserver ns2.dnshorizon.com:
    123456789.co.in SOA ns1.dnshorizon.com. saisan.gmail.com.
    2007062001 86400 7200 3600000 86400

    The above cmd prints the host's nameserver and its SOA record.

Ask Questions

Ask Question