host -- look up hostnames using domain server


host [-l] [-v] [-w] [-r] [-d] [-t querytype] [-a] host [server]


host looks for information about Internet hosts. It gets this information from a set of interconnected servers that are spread across the world. By default, it simply converts between hostnames and Internet addresses. However, with the -t or -a options, it can be used to find all of the information about a host that is maintained by the domain server.

The arguments can be either hostnames or host numbers. The program first attempts to interpret them as host numbers. If this fails, it will treat them as hostnames. A host number consists of integers separated by dots: for example, ``''. A hostname consists of names separated by dots: for example, ``''. Unless the name ends in a dot, the local domain is automatically tacked on the end. Thus, a Rutgers user can enter:

host topaz

and it will actually look up ``''. If this fails, the name is tried unchanged (in this case, ``topaz''). This same convention is used for mail and other network utilities. The actual suffix to tack on the end is obtained from the results of a hostname(ADMN) call, and using everything starting at the first dot. (See below for a description of customizing hostname lookup.)

The first argument is the hostname you want to look up. If this is a number, an inverse query is done: the domain system looks in a separate set of databases used to convert numbers to names.

The second argument is optional. It allows you to specify a particular server to query. If you don't specify this argument, the default server (normally the local machine) is used.

If a name is specified, you may see output of three different kinds. Here is an example that shows all of them:

   %host sun4 is a nickname for ATHOS.RUTGERS.EDU
   ATHOS.RUTGERS.EDU has address
   ATHOS.RUTGERS.EDU has address
The first line of output indicates that the name ``'' is actually a nickname. The official hostname is ``ATHOS.RUTGERS.EDU''. The next two lines show the address. If a system has more than one network interface, there will be a separate address for each. The last line indicates that ATHOS.RUTGERS.EDU does not receive its own mail. Mail for it is taken by ARAMIS.RUTGERS.EDU. There may be more than one such line, since some systems have more than one system that will handle mail for them. Technically, every system that can receive mail is supposed to have an entry of this kind. If the system receives its own mail, there should be an entry that mentions the system itself; for example:
   XXX mail is handled by XXX
However, many systems that receive their own mail do not bother to mention that fact. If a system has a ``mail is handled by'' entry, but no address, this indicates that it is not really part of the Internet: a system that is on the network will forward mail to it. Systems on Usenet, Bitnet, and a number of other networks have entries of this kind.


There are a number of options that can be used before the hostname. Most of these options are meaningful only to the staff who have to maintain the domain database.

This causes host to wait forever for a response. Normally it will time out after approximately one minute.

Use ``verbose'' format for printout. This is the official domain master file format, see named(ADMN). Without this option, output still follows this format in general terms, but some attempt is made to make it more intelligible to normal users. Without -v, any, a, mx, and cname records are written out as has address, mail is handled by, and is a nickname for (respectively), and TTL and class fields are not shown.

Turn off recursion in the request. This means that the name server will return only data it has in its own database. It will not ask other servers for more information.

Turn on debugging. Network transactions are shown in detail.

Chase signatures back to parent key (DNSSEC).

-t querytype
Allows you to specify a particular querytype of information to be looked up. See named(ADMN) for definitions of the arguments. Currently-supported types include: a, ns, md, mf, cname, soa, mb, mg, mr, null, wks, ptr, hinfo, minfo, mx, uinfo, uid, gid and unspec. Additionally, the wildcard (which may be written as either any or *), can be used to specify any (all) of the above types. Types must be given in lower case. Note that the default is to look first for a, and then mx, except that if the verbose option is turned on, the default is only a. The -t option is particularly useful for filtering information returned by host. See the -l option below.

this is equivalent to -v -t any (``all'').

List a complete domain. For example:

host -l

gives a listing of all hosts in the domain. The -t option is used to filter what information is presented. The default is address information, which also includes PTR and NS records. The command:

host -l -v -t any

gives a complete download of the zone data for, in the official master file format. (However the SOA record is listed twice, for arcane reasons.)

NOTE: -l is implemented by doing a complete zone transfer and then filtering out the information that you have asked for. This command should be used only if it is absolutely necessary.

Customizing hostname lookup

In general, if the name supplied by the user does not have any dots in it, a default domain is appended to the end. This domain can be defined in /etc/resolv.conf, but is normally derived by taking the local hostname after its first dot. The user can override this, and specify a different default domain, using the environment variable LOCALDOMAIN. In addition, the user can supply abbreviations for hostnames. These should be in a file consisting of one line per abbreviation. Each line contains an abbreviation, a space, and then the full hostname. The name file must be contained in the HOSTALIASES environment variable.


Name of file containing host alias and full hostname pairs.


see resolver(SFF)

See also

named(ADMN), resolver(SFF)


Unexpected effects can happen when you type a name that is not part of the local domain. Please always keep in mind the fact that the local domain name is tacked onto the end of every name, unless it ends in a dot. Only if this fails is the name used unchanged.

The -l option only tries the first name server listed for the domain that you have requested. If this server is dead, you may need to specify a server manually. For example, to get a listing of, you could try:

host -t ns

To get a list of all the name servers for, and then try:

host -l xxx

for all xxx on the list of name servers, until you find one that works.

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003