Linux Command: nslookup
Query DNS name servers interactively
nslookup queries DNS name servers to find the IP address of a domain or the domain name for an IP address. It is one of the most commonly used DNS troubleshooting tools. nslookup can query specific record types (A, AAAA, MX, TXT, CNAME, NS, SOA) and use specific DNS servers. It operates in interactive or non-interactive mode. While dig is more detailed and preferred by DNS administrators, nslookup is available on virtually every operating system (including Windows) and is simpler for basic queries.
Syntax
nslookup [OPTION]... [HOST] [SERVER]Key Options
domainโ Look up domain A record-type=โ Specify record typedomain serverโ Use specific DNS server-debugโ Show detailed query info
Examples
Look up domain
nslookup example.comOutput: Server: 8.8.8.8
Name: example.com
Address: 93.184.216.34
MX records
nslookup -type=MX example.comOutput: example.com mail exchanger = 10 mail.example.com
TXT records
nslookup -type=TXT example.comPro Tips
- Compare: nslookup domain 8.8.8.8 vs nslookup domain 1.1.1.1. Different results may indicate DNS propagation delays.
- dig provides more detailed output with TTLs and authority info. nslookup is simpler for quick lookups.
- nslookup shows a deprecation warning on some systems. It still works fine, but dig and host are the recommended alternatives.
Learn more: Full nslookup reference โ
Related Resources