Name

host [options] name [server] — bind-utils

Synopsis

/usr/bin stdin stdout - file -- opt --help --version

The host command looks up the hostname or IP address of a remote machine by querying DNS.

$ host www.redhat.com
www.redhat.com has address 66.187.232.50
$ host 66.187.232.50
50.232.187.66.in-addr.arpa domain name pointer www.redhat.
com.

It can also find out much more:

$ host -a www.redhat.com
Trying "www.redhat.com"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50419
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3,
ADDITIONAL: 3

;; QUESTION SECTION:
;www.redhat.com.      IN  ANY

;; ANSWER SECTION:
www.redhat.com.    196  IN  A  66.187.232.50

;; AUTHORITY SECTION:
redhat.com.    90535  IN  NS  ns2.redhat.com.
redhat.com.    90535  IN  NS  ns3.redhat.com.
redhat.com.    90535  IN  NS  ns1.redhat.com.

;; ADDITIONAL SECTION:
ns2.redhat.com.    143358  IN  A  66.187.224.210
ns3.redhat.com.    143358  IN  A  66.187.229.10
ns1.redhat.com.    143358  IN  A  66.187.233.210

but a full discussion of nameservers is beyond the scope of this book. The final, optional “server” parameter lets you specify a particular nameserver for the query. Here’s one at comcast.net:

$ host www.redhat.com ns01.jdc01.pa.comcast.net
Using domain server:
Name: ns01.jdc01.pa.comcast.net
Address: 66.45.25.71#53
Aliases:
www.redhat.com has address 66.187.232.50

To see all options, type host by itself.

Useful options

-a

Display all available information.

-t

Choose the type of nameserver query: A, AXFR, CNAME, HINFO, KEY, MX, NS, PTR, SIG, SOA, and so on.

Get Linux Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.