Commands · Command

CommandLinuxmacOSWindows

nslookup

nslookup [name] [server]

Looks up DNS records for a hostname (or reverse-looks-up an IP), querying a specified DNS server or the system default.

// PLATFORM NOTES

Linux

interactive mode available (run `nslookup` with no arguments); largely superseded by `dig` for scripting.

macOS

same as Linux.

Windows

the primary built-in DNS lookup tool — Windows has no `dig`.

// FLAGS

(no args)enters an interactive prompt for running multiple lookups
-type=query a specific record type, e.g. -type=MX
[server]query a specific DNS server instead of the default

// EXAMPLE

nslookup example.com 8.8.8.8 — looks up example.com's DNS records specifically against Google's public DNS server.

// GOTCHA

On Linux/macOS, dig is generally preferred for scripting since its output is more consistent and machine-parseable — nslookup's output format has historically been considered less stable across versions, though it remains the standard tool on Windows.

// RELATED COMMANDS