nslookup
networkingLinux/Unix/Windows
The nslookup command is one of the most frequently used commands in Linux/Unix-like operating systems. nslookup Query Internet name servers for domain name or IP address mapping
Quick Reference
Command Name:
nslookup
Category:
networking
Platform:
Linux/Unix/Windows
Basic Usage:
nslookup [options] [arguments]
Common Use Cases
Syntax
nslookup [options] [hostname/IP] [server]
Options
Option | Description |
---|---|
-type= |
Specify the DNS record type to query (a, aaaa, mx, ns, soa, txt, etc.) |
-query= |
Synonym for -type= |
-debug |
Enable debug mode |
-timeout= |
Set the timeout for a query in seconds |
-port= |
Set the port to use for queries |
-recurse |
Ask for recursive service (default) |
-norecurse |
Don't ask for recursive service |
-ndots= |
Set number of dots that must be in name for it to be absolute |
-retry= |
Set number of retries |
-vc |
Use virtual circuit (TCP instead of UDP) |
Common DNS Record Types:
Record Type | Description |
---|---|
A | IPv4 address record |
AAAA | IPv6 address record |
CNAME | Canonical name record (alias) |
MX | Mail exchange record |
NS | Name server record |
PTR | Pointer record (for reverse DNS lookups) |
SOA | Start of authority record |
TXT | Text record |
ANY | All records (may be restricted by some DNS servers) |
Interactive Mode Commands:
Command | Description |
---|---|
server NAME | Set default server to NAME, using current default server |
lserver NAME | Set default server to NAME, using initial server |
set OPTION | Set an option (type, querytype, class, timeout, etc.) |
exit | Exit the program |
help | Print help information |
Examples
How to Use These Examples
The examples below show common ways to use the nslookup
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
nslookup example.com