What is the Linux Dig command?

Get ready to learn about a built-in utility tool that you can find on most Linux distros and use for domain probing. The tool is called Dig.

What is the Dig command?

Dig command is a built-in Linux command that you can access through the Terminal application and perform DNS queries. The full name is Domain Information Groper. You can troubleshoot your domain, get all kinds of information about it, including DNS records, name servers, and general network data. What is awesome about it is that it has more functionality than some other built-in tools like nslookup, and it is very easy to use. This is why many network administrators are using it daily, despite its basic command-line interface. 

If you are interested in Dig commands we recommend you to look at this article – 10 most used Dig commands!

Why should you try the Dig command?

You should try the dig command because it is superior to more limited software like nslookup and ping and can do the following:

  • Probe a domain name and get general information about it. 
  • See a list of all available DNS records with their values. 
  • Check all DNS records of a particular type like MX records. You can get all of them and see if there are more than one and they are correctly set up. 
  • Check not only domain names but IP addresses too. 
  • Trace the full route, hop by hop of a query to its destination. 

Why is Dig command better?

Dig command provides more rich answers, even when you perform a basic query (dig + hostname) in comparison to nslookup (nslookup + hostname). It will show you if the answer that you are receiving is from an authoritative name server or recursive. It will also show you TTL values easily, without the need for extra probes. 

In comparison with the host command, the dig command has a clear separation of question part, answer part, authority, and additional sections. 

The dig also has more options for fine-tuning your probing, in comparison to the host command. You can really customize the Dig command’s output and make it show you just what you want. 

How to install the Dig command? 

Most of the Linux distros already have the Dig command by default. If you are using Linux and want to check if you have it, use the following command:

dig -v

If you have it, you will see the version of it (for example, DiG 9.11.3-1ubuntu1.7-Ubuntu), and if not, you will see “dig command not found”.

If you get a negative message, don’t worry. You can install it easily.

Ubuntu, Debian, Linux Mint, Kali Linux, and other Ubuntu-based and Debian-based.

sudo apt update && sudo apt install dnsutils

Red Hat, CentOS, or Fedora.

sudo yum install bind-utils

Arch Linux, Manjaro, and other Arch-based distros.

sudo pacman -S bind-tools

Recommended article: NSlookup commands – How to use them?

Dig commands examples 

Here you have several examples of dig commands with different DNS record:

dig google.com AAAA (IPv6)

dig yahoo.com NS (all name servers for the domain)

dig bing.com MX (incoming emails server for the domain)

dig yandex.com PTR (pointer for reverse lookups)

dig duckduckgo.com SOA (start of authority)

dig baidu.com A (IPv4) 

Use the pattern:

dig domain.com DNS type

And change domain.com with a domain you want and DNS type with the one you want.

dig -x (reverse DNS lookup)

dig domain.com @ (use the name server and check its cache memory for the particular domain)

dig ns1.domain.com (check a particular nameserver)


This is the dig command and how you can use it. It is a nifty small utility tool that you can easily use on your Linux computer. Go try it out, see for what it can be useful to you.

Article Writter By


Write a Comment

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