Skip to Content
Linux Pocket Guide, 2nd Edition
book

Linux Pocket Guide, 2nd Edition

by Daniel J. Barrett
March 2012
Beginner to intermediate
230 pages
7h 27m
English
O'Reilly Media, Inc.
Content preview from Linux Pocket Guide, 2nd Edition

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

-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.

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, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Linux Pocket Guide, 3rd Edition

Linux Pocket Guide, 3rd Edition

Daniel J. Barrett
Linux Pocket Guide

Linux Pocket Guide

Daniel J. Barrett

Publisher Resources

ISBN: 9781449332969Errata Page