nslookup -- query Internet name servers interactively


nslookup [ -option ... ] [ host-to-find | - [ server ]]


nslookup is a program to query Internet domain name servers. nslookup has two modes: interactive and non-interactive. Interactive mode allows the user to query name servers for information about various hosts and domains or print a list of hosts in the 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:

Non-interactive mode is used when the name of 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 Internet address of a name server.

The options listed under the set command below 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 timeout to 10 seconds, type: nslookup -query=hinfo -timeout=10

Interactive commands

Commands may be interrupted at any time by typing the system interrupt character (<Del> by default). To exit, type a <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 (\). Note that an unrecognized command will be interpreted as a host name.

Look up information for host using the current default server or using server if it is 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 not in the current domain, append a period to the name.

server domain
lserver domain
Change the default server to domain. lserver uses the initial server to look up information about domain while server uses the current default server. If an authoritative answer can not 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 the lserver 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). name is optional. ``>'' and ``>>'' can be used to redirect output in the usual manner.

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. option can be one of the following:

-t querytype
lists all records of the specified type (see querytype below)

lists aliases of hosts in the domain (synonym for -t CNAME)

lists all records for the domain (synonym for -t ANY)

lists CPU and operating system information for the domain (synonym for -t HINFO)

lists well-known services of hosts in the domain (synonym for -t WKS)
When output is directed to a file, number signs are printed for every 50 records received from the server.

view filename
Sorts and lists the output of previous ls command(s) with more(C).

help or ?
Prints a brief summary of commands.

Exits the program.

set keyword[=value]
This command changes 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 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. A lot more information is printed about the packet sent to the server and the resulting answer. (Default = nodebug, abbreviation = [no]deb)

Turn exhaustive debugging mode on. Essentially all fields of every packet are printed. (Default = nod2)

If set, append the default domain name to a single-component lookup request (i.e., one that does not contain a period). (Default = defname, abbreviation = [no]def)

With defname, search for each name in parent domains of the current domain. (Default = search)

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 CC.Berkeley.EDU, the search list is CC.Berkeley.EDU and Berkeley.EDU. Use the set srchlist command to specify a different list. Use the set all command to display the list. (Default = value based on hostname command, /etc/resolv.conf file or LOCALDOMAIN variable; abbreviation = do)

Change the default domain name to name1 and the domain search list to name1, name2, etc. A maximum of 6 names separated by slashes (``/'') can be specified. For example:

set srchlist=lcs.MIT.EDU/ai.MIT.EDU/MIT.EDU.

sets the domain to ``lcs.MIT.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 command, /etc/resolv.conf file or LOCALDOMAIN variable; abbreviation = srchl)

Ignore truncate error. (Default = noignore)

Connect to name server using port#. (Default = well known port number)

Change the type of information returned from a query to one of:

the host's Internet address (the default)

the canonical name for an alias

the host CPU and operating system type

the mail exchanger

the mailbox or mail list information

nameserver 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, ty)

Tell the name server to query other servers if it does not have the information. (Default = recurse, abbreviation = [no]rec)

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 request is resent. The retry value controls how many times a request is resent before giving up. (Default = 2, abbreviation = ret)

Change the name of the root server to host. This affects the root command. (Default =, abbreviation = ro)

Change the time-out interval for waiting for a reply to number seconds. (Default = 10 seconds, abbreviation = t)

Always use a virtual circuit when sending requests to the server. (Default = novc, abbreviation = [no]v)

Ignore packet truncation errors. (Default = noignoretc, abbreviation = [no]ig)


If the lookup request was not successful, an error message is printed. Possible errors are:

The server did not respond to a request after a certain amount of time (changed with set timeout=value) and a certain number of retries (changed with set retry=value).

No information
Depending on the query type set with the set querytype command, no information about the host was available, though the host name is valid.

Non-existent domain
The host or domain name does not exist.

Connection refused
Network is unreachable
The connection to the name or finger server could not be made at the current time. This error commonly occurs with finger requests.

Server failure
The name server found an internal inconsistency in its database and could not return a valid answer.

The name server refused to service the request.
The following error should not occur and it indicates a bug in the program:

Format error
The name server found that the request packet was not in the proper format.


initial domain name and name server addresses

summary of commands

user's initial options

Environment variables

file containing host aliases

overrides default domain

See also

resolver(SLIB), resolver(SFF), named(ADMN)

RFC 1034

Standards conformance

nslookup is conformant with RFC 1035 (STD 13)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005