LinuxCommandLibrary

nslookup

TLDR

Lookup IP address

$ nslookup [example.com]
copy
Lookup using specific DNS server
$ nslookup [example.com] [8.8.8.8]
copy
Reverse DNS lookup
$ nslookup [192.168.1.1]
copy
Query specific record type
$ nslookup -type=[MX] [example.com]
copy
Interactive mode
$ nslookup
copy
Debug mode
$ nslookup -debug [example.com]
copy

SYNOPSIS

nslookup [options] [host] [server]

DESCRIPTION

nslookup queries DNS servers for hostname and IP information. It can perform forward and reverse lookups, query specific record types, and diagnose DNS issues.
The tool operates in interactive or non-interactive mode, with interactive mode allowing multiple queries.

PARAMETERS

-type= type

Record type (A, AAAA, MX, NS, TXT, SOA, PTR).
-query= type
Alias for -type.
-debug
Show debug information.
-port= port
DNS server port.
-timeout= seconds
Query timeout.
-retry= n
Number of retries.

INTERACTIVE COMMANDS

server name: Set DNS server
set type= type: Set query type
set debug: Enable debug
exit: Quit

CAVEATS

Deprecated in favor of dig. Behavior varies by implementation. Interactive mode differs from command line. Some features implementation-specific.

HISTORY

nslookup was written by Andrew Cherenson at UC Berkeley as part of BIND. While still included in most systems, the BIND documentation recommends using dig for DNS queries due to more consistent behavior.

SEE ALSO

dig(1), host(1), drill(1), getent(1)

Copied to clipboard