host - Unix, Linux Command

host - DNS lookup utility
host [-aCdlnrsTwv] [-c class] [-N ndots] [-R number] [-t type] [-W wait] [-m flag] [-4] [-6] {name} [server]
When no arguments or options are given, host prints a short summary of its command line arguments and options.
 
EXAMPLE-1:
Making simple query for any site say google.com using sitename
$ host google.comoutput:

google.com has address 172.217.26.174google.com has IPv6 address 2404:6800:4007:801::200egoogle.com mail is handled by 20 alt1.aspmx.l.google.com.google.com mail is handled by 30 alt2.aspmx.l.google.com.google.com mail is handled by 40 alt3.aspmx.l.google.com.google.com mail is handled by 10 aspmx.l.google.com.google.com mail is handled by 50 alt4.aspmx.l.google.com.
EXAMPLE-2:
Making host query using IP address:
$ host 172.217.26.174

output:174.26.217.172.in-addr.arpa domain name pointer maa03s22-in-f14.1e100.net.
EXAMPLE-3:
To display MX records for google.com domain
$ host -n -t mx google.com

output:#  host -n -t mx google.comgoogle.com mail is handled by 10 aspmx.l.google.com.google.com mail is handled by 50 alt4.aspmx.l.google.com.google.com mail is handled by 40 alt3.aspmx.l.google.com.google.com mail is handled by 20 alt1.aspmx.l.google.com.google.com mail is handled by 30 alt2.aspmx.l.google.com.
EXAMPLE-4:
To find out the domain name servers
$ host -t ns google.comoutput:# host -t ns google.comgoogle.com name server ns3.google.com.google.com name server ns1.google.com.google.com name server ns2.google.com.google.com name server ns4.google.com.

EXAMPLE-5:
Find out the domain TXT record
$ host -t txt google.com

output:google.com descriptive text "v=spf1 include:_spf.google.com ~all"
EXAMPLE-6:
Find out the SOA record:
$ host -t soa google.com

output:google.com has SOA record ns4.google.com. dns-admin.google.com. 143179694 900 900 1800 60
 
EXAMPLE-7:
Query Particular Name Server
$ host google.com ns4.google.comoutput:

Using domain server:Name: ns4.google.comAddress: 216.239.38.10#53Aliases:google.com has address 216.58.196.110google.com has IPv6 address 2404:6800:4007:806::200egoogle.com mail is handled by 40 alt3.aspmx.l.google.com.google.com mail is handled by 50 alt4.aspmx.l.google.com.google.com mail is handled by 30 alt2.aspmx.l.google.com.google.com mail is handled by 10 aspmx.l.google.com.google.com mail is handled by 20 alt1.aspmx.l.google.com.
EXAMPLE-8:
Display all information regarding Domain Records and Zone:
$ host -a amazon.inoutput:Trying "amazon.in";; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26969;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 7, ADDITIONAL: 12;; QUESTION SECTION:;amazon.in.                     IN      ANY;; ANSWER SECTION:amazon.in.              5       IN      A       178.236.7.18amazon.in.              5       IN      A       54.239.32.8amazon.in.              5       IN      A       54.239.34.40;; AUTHORITY SECTION:in.                     5       IN      NS      c0.in.afilias-nst.info.in.                     5       IN      NS      a2.in.afilias-nst.info.in.                     5       IN      NS      b2.in.afilias-nst.org.in.                     5       IN      NS      a0.in.afilias-nst.info.in.                     5       IN      NS      b1.in.afilias-nst.in.in.                     5       IN      NS      b0.in.afilias-nst.org.in.                     5       IN      NS      a1.in.afilias-nst.in.;; ADDITIONAL SECTION:a0.in.afilias-nst.info. 5       IN      A       199.7.87.1a0.in.afilias-nst.info. 5       IN      AAAA    2001:500:29::1a1.in.afilias-nst.in.   5       IN      A       115.249.164.142a2.in.afilias-nst.info. 5       IN      A       199.249.117.1a2.in.afilias-nst.info. 5       IN      AAAA    2001:500:45::1b0.in.afilias-nst.org.  5       IN      A       199.253.56.1b0.in.afilias-nst.org.  5       IN      AAAA    2001:500:50::1b1.in.afilias-nst.in.   5       IN      A       180.179.215.70b1.in.afilias-nst.in.   5       IN      AAAA    2401:8800:411:8::70b2.in.afilias-nst.org.  5       IN      A       199.249.125.1b2.in.afilias-nst.org.  5       IN      AAAA    2001:500:4d::1c0.in.afilias-nst.info. 5       IN      A       199.253.57.1Received 498 bytes from 192.168.134.2#53 in 498 ms

EXAMPLE-9:
Get TTL Information
$ host -v -t a google.comoutput:Trying "google.com";; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37908;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4;; QUESTION SECTION:;google.com.                    IN      A;; ANSWER SECTION:google.com.             5       IN      A       172.217.26.174;; AUTHORITY SECTION:google.com.             5       IN      NS      ns2.google.com.google.com.             5       IN      NS      ns4.google.com.google.com.             5       IN      NS      ns1.google.com.google.com.             5       IN      NS      ns3.google.com.;; ADDITIONAL SECTION:ns1.google.com.         5       IN      A       216.239.32.10ns2.google.com.         5       IN      A       216.239.34.10ns3.google.com.         5       IN      A       216.239.36.10ns4.google.com.         5       IN      A       216.239.38.10Received 180 bytes from 192.168.134.2#53 in 54 ms


    129 Lectures 
     23 hours 

 Eduonix Learning Solutions

    5 Lectures 
     4.5 hours 

 Frahaan Hussain

    35 Lectures 
     2 hours 

 Pradeep D

    41 Lectures 
     2.5 hours 

 Musab Zayadneh

    46 Lectures 
     4 hours 

 GUHARAJANM

    6 Lectures 
     4 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page