Software & AppsOperating SystemLinux

How To Install Dig for DNS Lookup on Ubuntu

Ubuntu 4

In this article, we’ll guide you through the process of installing dig, a handy tool for DNS lookup, on Ubuntu. dig is a part of the dnsutils package, which also includes other useful utilities like nslookup and nsupdate.

Quick Answer

To install dig for DNS lookup on Ubuntu, you can use the terminal command sudo apt-get install dnsutils. This will install the dnsutils package, which includes dig. Alternatively, you can use the Ubuntu Software Center to install dnsutils.

What is Dig?

dig (Domain Information Groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. Most DNS administrators use dig to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output. Other lookup tools tend to have less functionality than dig.

Installing Dig

Using Terminal

The most straightforward method to install dig is through the terminal. Open your terminal and run the following command:

sudo apt-get install dnsutils

This command does a few things:

  • sudo: This command gives you administrative privileges (root access). You’ll likely need to enter your password.
  • apt-get: This is Ubuntu’s package handler that can be used to install and uninstall software.
  • install: This tells apt-get to install a package.
  • dnsutils: This is the package you want to install.

After running this command, the dnsutils package, which includes dig, will be installed on your system.

Using Ubuntu Software Center

If you prefer a GUI for installing software, you can use the Ubuntu Software Center. Click on the following link to open the Software Center and install dnsutils:

Install via the software center

Finding Dig

If you’re unsure which package contains dig, you can use the apt-cache command:

sudo apt-cache search dig

This command will display a list of packages related to dig. Look for dnsutils in the results.

Using Apt-File

Another method to find the package containing dig is to use the apt-file command. Here’s how to do it:

First, install apt-file:

sudo apt-get install apt-file

Next, update the package information:

sudo apt-file update

Finally, search for the package containing dig:

apt-file search /usr/bin/dig

This will provide you with the package name that contains dig.


In this article, we’ve covered various methods to install dig for DNS lookup on Ubuntu. Whether you prefer using the terminal or a GUI like the Ubuntu Software Center, you should now be able to install dig and start using it for DNS troubleshooting. Remember, dig is a powerful tool, so use it wisely and responsibly. Happy troubleshooting!

What is DNS lookup?

DNS lookup is the process of querying a DNS (Domain Name System) server to retrieve information about a specific domain name. It is commonly used to translate domain names into IP addresses.

Why would I need to use `dig` for DNS lookup?

dig is a powerful tool that provides more flexibility and functionality compared to other DNS lookup tools. It allows you to perform advanced DNS queries, troubleshoot DNS issues, and obtain detailed information about DNS records.

Can I use `dig` to query multiple DNS servers?

Yes, you can specify the DNS server you want to query using the @ symbol followed by the IP address or domain name of the DNS server. For example, to query a specific DNS server, you can use the command dig @

How can I check the DNS records for a specific domain using `dig`?

To check the DNS records for a domain, you can use the command dig This will display various DNS records associated with the domain, such as A, CNAME, MX, and TXT records.

Can I perform a reverse DNS lookup with `dig`?

Yes, you can perform a reverse DNS lookup using dig. To do this, you need to specify the IP address you want to lookup in the form of a special domain name called the reverse DNS zone. For example, to perform a reverse DNS lookup for the IP address, you can use the command dig -x

How can I limit the number of results displayed by `dig`?

You can limit the number of results displayed by dig using the +short option. This option displays only the essential information and omits additional details. For example, to display only the IP address associated with a domain, you can use the command dig +short

Are there any other useful utilities included in the `dnsutils` package?

Yes, the dnsutils package includes other useful utilities like nslookup and nsupdate. nslookup is another DNS lookup tool that provides similar functionality to dig, while nsupdate is used to dynamically update DNS records.

How can I uninstall the `dnsutils` package?

To uninstall the dnsutils package, you can use the command sudo apt-get remove dnsutils. This will remove the package from your system, including dig and other utilities included in the package.

Leave a Comment

Your email address will not be published. Required fields are marked *