nslookup
Networking
Usage
nslookup <name> [server]The older name-to-address lookup tool: it still runs, but its output layout and exit status are inconsistent enough to be useless in scripts, and dig has taken its place.
Common flags
| Flag | Meaning |
|---|---|
| <name> <server> | The resolver to ask goes second, with no flag. |
| -type=MX | Record type, written with an equals sign. |
| -debug | Show the full packet, including the flags in the header. |
| (no argument) | Drops into an interactive prompt where you use "set type=MX". |
Examples
nslookup example.com 1.1.1.1A quick lookup against a chosen resolver.
nslookup -type=MX example.comMail records, the nslookup spelling.
When a connection fails, these narrow down how far it got — name not resolving, no route, or a blocked port.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does nslookup do?
The older name-to-address lookup tool: it still runs, but its output layout and exit status are inconsistent enough to be useless in scripts, and dig has taken its place.
Q. How do I type it?
nslookup <name> [server] — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
4 are listed here; the full set is in man nslookup. This command sits under Networking.
Related commands
man page: man nslookup