[Solved]: dig: command not found – How to install dig on CentOS/Redhat/Fedora Linux using yum

Updated on September 1, 2017

Question: I followed your tutorial – how to identify the DNS server IP address configured on my CentOS 6 using the dig command and ran into an error as shown below:

-bash: dig: command not found

Well, the error was clear. So I tried to install dig via yum as shown below:

[root@cloud2 ~]# yum install dig

Unfortunately, yum couldn’t find a package in the repository. Please help me to install dig on CentOS-6?

Solution:

Sometimes the command might be shipped as part of a package. It means, dig is not a package by itself and it’s packaged in bind-utils. So it’s a good idea to find out which package the command dig belongs to? Follow the tutorial: How to Find Which Package an Executable or File belongs to in RedHat/CentOS/Fedora?

[root@cloud2 ~]# yum provides *bin/dig
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* extras: centos.excellmedia.net
* remi-safe: mirror.innosol.asia
* updates: centos.excellmedia.net
32:bind-utils-9.8.2-0.37.rc1.el6.x86_64 : Utilities for querying DNS name servers
Repo        : base
Matched from:
Filename    : /usr/bin/dig
...
...

install bind-utils linux

From the above output, it clear that the dig command is a part of BIND utilities. Now go ahead and install BIND utilities as shown below:

[root@cloud2 ~]# yum install bind-utils

After successful installation, check if the dig command is installed and its path:

[root@cloud2 ~]# whereis dig
dig: /usr/bin/dig /usr/share/man/man1/dig.1.gz
[root@cloud2 ~]# which dig
/usr/bin/dig
[root@cloud2 ~]#

Now, learn how to use dig command.

Was this article helpful?

Related Articles

Leave a Comment