Dig command: How to use it in Linux?

What does the Dig command do?

Domain Information Groper, or DIG for short, is a wonderful command-line utility. To provide comprehensive details on mail exchanges, host addresses, and other relevant information, we use Dig to query the DNS name server. This utility is compatible with a variety of operating systems, including Linux and macOS.

You can do DNS queries using the built-in Linux Dig command by using the Terminal application. Your domain can be troubleshot, and you can learn a lot of details about it, such as DNS records, Name servers, and general network information. Its excellent features include having more functionality than some built-in utilities, like nslookup, and being quite simple to use. Because of this, despite having a straightforward command-line interface, many network administrators use it often.

For what do we use it?

You can inspect and check a name server and various kinds of DNS records and finish a reverse DNS, among other things, with the help of the Dig command. You should try the dig command because it is more powerful than less powerful software such as nslookup and ping and can do the following:

  • You can use it to check every name server.
  • Once you have viewed a name server via an earlier probe, you can probe that specific name server.
  • You might look for every DNS record for your domain that is accessible.
  • It allowed you to search precisely for certain DNS record types, such as A, AAAA, MX, NS, SOA, TXT, CNAME, and others.
  • In contrast to the host command, the dig command clearly separates the question, answer, authority, and additional sections.
  • You can execute a reverse DNS lookup by looking up an IP address (IPv4 or IPv6) and the hostname it belongs to.
  • You may follow a DNS query’s path from a particular location, such as your device or another resolver, to the hostname or IP address.

How to use the Dig command?

The Dig command is already preinstalled in the majority of Linux distributions. Use the following command to see if you have it if you are running Linux:

dig -v

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

Don’t be concerned if you receive a nasty message. It is simple to install.

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

sudo apt update && sudo apt install dnsutils

CentOS, Fedora, or Red Hat.

sudo yum install bind-utils

Manjaro, Arch Linux, and other distributions based on Arch.

sudo pacman -S bind-tools


Linux Operating System is really valuable and helpful. Why? Because with it, in the Terminal application, you can test a lot of Linux commands (Ping, Host, Sudo, Cat, etc.). And the dig command is one of them. Moreover, it is a network tool for learning about domain name servers. So, if you are new in the DNS world, you need to know it. 

Popular Linux commands every beginner should know

Linux commands – Explanation

Linux commands are Linux operating system utilities. An interface that receives lines of text and converts them into instructions for your computer is known as a command line.

In addition, we use the Linux terminal to run the commands. Similar to the command prompt in the Windows OS, the terminal is a command-line interface for interacting with the system. A graphical user interface (GUI) is simply a command-line application abstraction. 

List of the Basic Linux commands

  1. su / sudo command

On a Linux system, several commands require higher privileges in order to execute. These have to be executed in system administrator mode.

The shell is modified by the su command to function as a super user.  You can use the sudo command if you just need to run something as the super user. This will enable you to execute the command with elevated access, and after it has finished, your rights and permissions will revert to normal.

  1. host command

In Linux, a straightforward program called host is used for DNS lookups. It is typically used to convert a hostname to an IP address or the other way around.

  1. mv command

Linux’s mv command stands for “move.” It serves two key purposes in Linux:

  • Using this command, a file or directory can be renamed.
  • A file or directory can be readily moved from one place to another.
  1. ipconfig command

Show the system’s IP and Mac address.

  1. dig command

You can use the dig command to find out details about different DNS records, such as host addresses, mail exchanges, and name servers. Because of its adaptability and simplicity, system administrators utilize it the most frequently to troubleshoot DNS issues.

  1. cat command

Cat is an abbreviation for “concatenate.” It’s a common multi-purpose Linux command. This command generates, displays, and copies file content to standard output.

  1. ping command

You may check if you are connected to another network device with the ping command. It is frequently used to assist in troubleshooting networking problems. Give the other device’s IP address or machine name in order to utilize ping.

  1. man command

Man pages are included with almost all Linux commands. A man or manual page is a type of documentation that describes the function of command, provides examples of how to use it, and lists the inputs it will accept.

  1. grep command

The grep command looks for lines that include a search pattern. It may also search the contents of files. When examining the alias command, we used it to browse the output of ps. Here, we’re looking for the term “train” anywhere in the current directory’s text files.


You are now familiar with the fundamental Linux commands. What is your next step? To put them into action and to practice your new knowledge.