The nslookup utility can be installed and used on a Linux system to find out information about the DNS records for a domain or IP address. It's particularly handy when troubleshooting DNS issues. A popular tool that also comes installed with nslookup is dig, which is similar but uses different resolvers. It's a good alternative to nslookup, but nslookup is typically easier to use.

In this tutorial, we'll guide you through the installation of nslookup on major Linux distributions and show various command line examples that you can use on your own system when you need to obtain DNS information.

In this tutorial you will learn:
  • How to install nslookup on major Linux distros
  • Nslookup command line examples
nslookup command on Linux
nslookup command on Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software nslookup
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

Install nslookup

There's a good chance that nslookup is already installed on your system and ready to use. But, if not, just use the appropriate command below to install it.

Subscribe to our NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.

To install nslookup on Ubuntu, Debian, Linux Mint, and any other Debian based distribution:

$ sudo apt install dnsutils

To install nslookup on CentOS, Fedora, Red Hat, and any other Red Hat based distribution:

$ sudo dnf install bind-utils

To install nslookup on Manjaro, Arch Linux, and any other Arch Linux based distribution:

$ sudo pacman -S dnsutils

Nslookup command line examples

Now that nslookup is installed, try some of the following commands to get a feel for how it works.

To see basic information about a domain's A record, simply specify the domain name as an argument. The output may contain multiple IP addresses, depending on the queried server's configuration.

$ nslookup

Non-authoritative answer:

You can also look up the reverse DNS record by specifying the IP address and seeing which domain name it points to.

$ nslookup	name =

To see the mail record (MX) for a domain, use the -query=MX option. This record controls where mail sent to the domain (in this case, is sent to.

$ nslookup -query=mx

Non-authoritative answer:	mail exchanger = 10	mail exchanger = 10

Use the -query=ns option to see a list of DNS servers for the domain.

$ nslookup -type=ns

Non-authoritative answer:	nameserver =	nameserver =	nameserver =	nameserver =	nameserver =	nameserver =

These are some of the main options for nslookup, although there are more query types available and further options. Check out the man page for more details, and maybe give the dig command a try as well.

$ man nslookup
$ man dig


In this guide, we learned how to install the nslookup utility on major Linux distributions. We also saw several example commands for querying DNS information from a domain name and IP address. The nslookup command is super handy when you need to see a concise list of DNS information.

Submit your RESUME, create a JOB ALERT.
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
Get extra help by visiting our LINUX FORUM or simply use comments below.