Name
host — stdin stdout - file -- opt --help --version
Synopsis
host [options
]name
[server
]
The host
command looks up
the hostname or IP address of a remote machine by querying
DNS.
$ host www.ubuntu.org www.ubuntu.com has address 91.189.90.41 $ host 91.189.90.41 41.90.189.91.in-addr.arpa domain name pointer jujube.canonical.com.
It can also find out much more:
$ host -a www.ubuntu.org Trying "www.ubuntu.org" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16652 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ... ;; QUESTION SECTION: ;www.ubuntu.org. IN ANY ;; ANSWER SECTION: www.ubuntu.org. 60 IN CNAME ubuntu.org.
though a full discussion of this output is beyond the scope of this book. The final, optional “server” parameter specifies a particular nameserver for the query:
$ host www.ubuntu.org ns2.dondominio.com Using domain server: Name: ns2.dondominio.com Address: 93.93.67.2#53 Aliases: www.ubuntu.org is an alias for ubuntu.org. ubuntu.org has address 147.83.195.55 ubuntu.org mail is handled by 10 mx2.upc.es. ubuntu.org mail is handled by 10 mx1.upc.es.
To see all options, type host
by itself.
Useful options
|
Display all available information. |
|
Choose the type of
nameserver query: |
Here’s an example of the -t
option to locate MX records:
$ host -t MX redhat.com redhat.com mail is handled by 5 mx1.redhat.com. redhat.com mail is handled by 10 mx2.redhat.com.
If the host
command doesn’t do what you want, ...
Get Linux Pocket Guide, 2nd Edition 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.