The nslookup(1) is a program that is used to query
Internet domain name servers. The nslookup(1) utility has
two modes: interactive and non-interactive. Interactive mode allows
the user to query name servers for information about various hosts
and domains, or to print a list of hosts in a domain.
Non-interactive mode is used to print just the name and requested
information for a host or domain.
Interactive mode is entered in the following cases:
When no arguments are given (the default name server will be
When the first argument is a hyphen (-) and the second
argument is the host name or Internet address of a name
Non-interactive mode is used when the name or Internet address
of the host to be looked up is given as the first argument. The
optional second argument specifies the host name or address of a
The options listed under the set command (described later
in this topic) can be specified in the .nslookuprc file in
the user's home directory if they are listed one per line. Options
can also be specified on the command line if they precede the
arguments and are prefixed with a hyphen. For example, to change
the default query type to host information, and the initial
time-out to 10 seconds, type:
Commands can be interrupted at any time by typing CTRL+C. To
exit, type CTRL+D (EOF), or type exit. The command-line
length must be less than 256 characters. To treat a built-in
command as a host name, precede it with an escape character
(\). An unrecognized command will be interpreted as a host
Look up information for host using the current default
server or using server, if specified. If host is an
Internet address and the query type is A or PTR, the name of the
host is returned. If host is a name and does not have a
trailing period, the default domain name is appended to the name.
(This behavior depends on the state of the set options
domain, srchlist, defname, and search.)
To look up a host that is not in the current domain, append a
period to the name.
Change the default server to domain. The lserver
command uses the initial server to look up information about
domain, and server uses the current default server.
If an authoritative answer cannot be found, the names of servers
that might have the answer are returned.
Changes the default server to the server for the root of the
domain name space. Currently, the host is used. (This command is a
synonym for lserver ns.internic.net.) The name of the root
server can be changed with the set root command.
finger [name] [>filename]
finger [name] [>>filename]
Connects with the finger server on the current host. The
current host is defined when a previous lookup for a host was
successful and returned address information (see the set
querytype=A command). The name is optional. You can use
> and >> to redirect output in the usual
ls [option] [domain] [>filename]
ls [option] [domain] [>>filename]
List the information available for domain, optionally
creating or appending to filename. The default output
contains host names and their Internet addresses. When output is
directed to a file, hash marks (#) are printed for every 50 records
received from the server. Option can be one of the
Lists all records of the specified type (see querytype
Lists aliases of hosts in the domain; synonym for -t
Lists all records for the domain; synonym for -tANY.
Lists CPU and operating system information for the domain;
synonym for -tHINFO.
Lists well-known services of hosts in the domain; synonym for
Sorts and lists the output of one or more previous ls(1)
commands with more(1).
Prints a brief summary of commands.
Exits the program.
This command is used to change state information that affects
the lookups. Valid keywords are:
Prints the current values of the frequently used options to
set. Information about the current default server and host
is also printed.
Change the query class to one of the following:
The Internet class
The Chaos class
The MIT Athena Hesiod class
Wildcard (any of the above)
The class specifies the protocol group of the information.
(Default = IN; abbreviation = cl)
Turn debugging mode on. Considerably more information is
printed about the packet sent to the server and the resulting
(Default = nodebug; abbreviation =
Turn exhaustive debugging mode on. All fields of every packet
(Default = nod2)
Change the default domain name to name. The default
domain name is appended to a lookup request, depending on the state
of the defname and search options. The domain search
list contains the parents of the default domain if it has at least
two components in its name. For example, if the default domain is
topaz.anycollege.edu, the search list is topaz.anycollege.edu and
anycollege.edu. Use the set srchlist command to specify a
different list. Use the set all command to display the list.
(Default = value from hostname(1),
/etc/resolv.conf, or LOCALDOMAIN; abbreviation =
Change the default domain name to name1 and the domain
search list to name1, name2, and so on. A maximum of
six names separated by slashes (/) can be specified. For
sets the domain to topaz.anycollege.edu and the search list to
the three names. This command overrides the default domain name and
search list of the set domain command. Use the set all
command to display the list.
(Default = value based on hostname(1),
/etc/resolv.conf, or LOCALDOMAIN; abbreviation =
If set, append the default domain name to a single-component
lookup request (that is, one that does not contain a period).
(Default = defname; abbreviation =
If the lookup request contains at least one period but does not
end with a trailing period, append the domain names in the domain
search list to the request until an answer is received.
(Default = search; abbreviation =
Change the default Transmission Control Protocol/User Datagram
Protocol (TCP/UDP) name server port to value.
(Default = 53; abbreviation = po)
Change the type of information query to one of the following:
the host's Internet address.
The canonical name for an alias.
The host CPU and operating system type.
The mailbox or mail list information.
The mail exchanger.
The name server for the named zone.
The host name if the query is an Internet address; otherwise,
the pointer to other information.
The domain's start-of-authority information.
The text information.
The user information.
The supported well-known services.
Other types (ANY, AXFR, MB, MD,
MF, NULL) are described in the RFC-1035 document.
(Default = A; abbreviations = q,
Tell the name server to query other servers if it does not have
(Default = recurse; abbreviation =
Set the number of retries to number. When a reply to a
request is not received within a certain amount of time (changed
with set timeout, the time-out period is doubled and the
request is resent. The retry value controls how many times a
request is re-sent before it stops re-sending it.
(Default = 4, abbreviation = ret)
Change the name of the root server to host. This affects
the root command.
(Default = ns.internic.net.; abbreviation =
Change the initial time-out interval for waiting for a reply to
number seconds. Each retry doubles the time-out period.
(Default = 5 seconds; abbreviation =ti)
Always use a virtual circuit when sending requests to the