🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

nslookup Command

Beginner Networking man(1)

Query DNS name servers interactively

👁 8 views 📅 Updated: Mar 16, 2026
SYNTAX
nslookup [OPTION]... [HOST] [SERVER]

What Does nslookup Do?

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.

Options & Flags

OptionDescriptionExample
domain Look up domain A record nslookup example.com
-type= Specify record type nslookup -type=MX example.com
domain server Use specific DNS server nslookup example.com 8.8.8.8
-debug Show detailed query info nslookup -debug example.com

Practical Examples

#1 Look up domain

Finds the IP address for a domain.
$ nslookup example.com
Output: Server: 8.8.8.8 Name: example.com Address: 93.184.216.34

#2 MX records

Finds mail server records for the domain.
$ nslookup -type=MX example.com
Output: example.com mail exchanger = 10 mail.example.com

#3 TXT records

Shows TXT records (SPF, DKIM, verification).
$ nslookup -type=TXT example.com

#4 Use specific DNS server

Queries Google DNS instead of your default server.
$ nslookup example.com 8.8.8.8

#5 Reverse lookup

Finds the domain name for an IP address.
$ nslookup 8.8.8.8
Output: 8.8.8.8.in-addr.arpa name = dns.google

#6 NS records

Shows authoritative name servers for the domain.
$ nslookup -type=NS example.com

Tips & Best Practices

Test different DNS servers: Compare: nslookup domain 8.8.8.8 vs nslookup domain 1.1.1.1. Different results may indicate DNS propagation delays.
dig is more detailed: dig provides more detailed output with TTLs and authority info. nslookup is simpler for quick lookups.
Deprecated notice: nslookup shows a deprecation warning on some systems. It still works fine, but dig and host are the recommended alternatives.

Frequently Asked Questions

How do I find the IP of a domain?
nslookup domain.com returns the IP address. Or use dig domain.com for more detail.
How do I check MX records?
nslookup -type=MX domain.com shows mail server records.
How do I use a different DNS server?
nslookup domain.com 8.8.8.8 queries Google DNS instead of your default.

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →