← All commands
Topic hub Networking
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
Debian/Ubuntu same command
dig / nslookup
Fedora same command
dig / nslookup
Arch same command
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 optionUse
dig google.comA record (IPv4 address)
dig google.com MXMail server records
dig google.com NSName server records
dig +short google.comJust the IP, no extra info
dig -x 8.8.8.8Reverse lookup — IP to hostname
nslookup google.comSimple 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.

DistributionPackage manager / baseEquivalent commandDifference 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

Related Networking commands