Windows
Linux
Networking
Windows nslookup equivalent in Linux
Queries DNS servers to resolve hostnames to IP addresses and inspect DNS records.
Windows
→
nslookup
Linux equivalents
dig / nslookup
dig / nslookup
dig / nslookup
Overview
What this command does
Queries DNS servers to resolve hostnames to IP addresses and inspect DNS records.
Migration tip:
nslookup works on Linux too, but dig gives much more detail and is preferred by administrators. It's in the dnsutils package.Practical tasks
Common use cases
Look up DNS records
Queries DNS servers to resolve hostnames to IP addresses and inspect DNS records.
dig google.com
A record (IPv4 address)
dig google.com MX
Mail server records
dig google.com NS
Name server records
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
nslookup google.com
dig google.com
dig +short google.com
dig google.com MX
dig -x 8.8.8.8
Walkthrough
Examples with explanations
# Windows: nslookup google.com
nslookup google.com # works just like Windows
dig google.com # detailed DNS info
dig +short google.com # just the IP address
dig google.com MX # who handles Google's email
dig -x 8.8.8.8 # what host is 8.8.8.8?
Reference
Common options and variations
| Command or option | Use |
|---|---|
dig google.com | A record (IPv4 address) |
dig google.com MX | Mail server records |
dig google.com NS | Name server records |
dig +short google.com | Just the IP, no extra info |
dig -x 8.8.8.8 | Reverse lookup — IP to hostname |
nslookup google.com | Simple lookup (works same as Windows) |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | dig / nslookup |
Same command on this distribution. |
| Fedora | same command | dig / nslookup |
Same command on this distribution. |
| Arch | same command | dig / nslookup |
Same command on this distribution. |
Keep learning