CentOS 8 dig command not found – How to install dig on CentOS 8

I deployed minimal version of CentOS 8 in the cloud server. However, I am unable to find the dig command on my newly created CentOS 8 Linux server. It says ‘-bash: dig: command not found‘ I tried yum install dig, but it failed too. How do I install dig command on CentOS 8 Linux using the command line?

Introduction: The dig command is primarily used to query DNS servers. It is a useful tool for network troubleshooting. It is popular due to its flexibility, simple to use, and crystal clear output over host command. This page shows how to install dig command on a CentOS 8 using the ssh or terminal. You must log in as root user to install the following package on Linux.

ADVERTISEMENTS

CentOS 8 dig command not found

You may get the following error when you run dig command:
$ dig www.cyberciti.biz
$ dig +short myip.opendns.com @resolver1.opendns.com

Try to locate the dig with type command:
$ type -a dig
Display your PATH settings on Linux with help of echo command:
$ echo "$PATH"
CentOS 8 dig command not found

Getting rid of “-bash: dig: command not found” on CentOS 8

BIND (Berkeley Internet Name Domain) is an implementation of the DNS (Domain Name System) protocols. BIND includes a DNS server (named), which resolves host names to IP addresses; a resolver library and tools for verifying that the DNS server is operating properly. However, bind is not installed by default including the dig command.

You must install bind-utils package on CentOS 8. It contains a collection of utilities (such as dig command and other) for querying DNS name servers to find out information about internet hosts. These tools will provide you with the IP addresses for given host names, as well as other information about registered domains and network addresses.

Searching for packages

Search which yum package provides a dig or host command on CentOS 8:
$ yum whatprovides dig
$ yum whatprovides host

Sample outputs:

Last metadata expiration check: 0:56:25 ago on Saturday 28 September 2019 08:07:22 AM UTC.
bind-utils-32:9.11.4-16.P2.el8.x86_64 : Utilities for querying DNS name servers
Repo        : AppStream
Matched from:
Filename    : /usr/bin/dig
 
bind-utils-32:9.11.4-17.P2.el8_0.1.x86_64 : Utilities for querying DNS name servers
Repo        : AppStream
Matched from:
Filename    : /usr/bin/dig
 
bind-utils-32:9.11.4-17.P2.el8_0.x86_64 : Utilities for querying DNS name servers
Repo        : AppStream
Matched from:
Filename    : /usr/bin/dig

Getting information about package

Run the following command before installing the dig and host command on CentOS 8:
# yum info bind-utils

Last metadata expiration check: 0:08:24 ago on Tuesday 11 August 2020 10:33:14 PM IST.
Available Packages
Name         : bind-utils
Epoch        : 32
Version      : 9.11.13
Release      : 5.el8_2
Architecture : x86_64
Size         : 443 k
Source       : bind-9.11.13-5.el8_2.src.rpm
Repository   : AppStream
Summary      : Utilities for querying DNS name servers
URL          : http://www.isc.org/products/BIND/
License      : MPLv2.0
Description  : Bind-utils contains a collection of utilities for querying DNS (Domain
             : Name System) name servers to find out information about Internet
             : hosts. These tools will provide you with the IP addresses for given
             : host names, as well as other information about registered domains and
             : network addresses.
             : 
             : You should install bind-utils if you need to get information from DNS name
             : servers.

How to install dig on CentOS 8

Installing bind-utils is essential if you need to get information from DNS name servers. Type the following yum command/dnf command and press [Enter] key:
$ sudo yum install bind-utils

How to install dig on CentOS 8 using yum command

Installing the dig command on an CentOS 8 server

How do I use dig command on an CentOS 8 based system?

Try the following examples:
dig Your-Hostname
dig YourDomainName
dig @DNS-server-name Hostname
dig @DNS-server-name IPAddress
dig @DNS-server-name Hostname|IPAddress type

For example:
$ dig www.cyberciti.biz
$ dig @1.1.1.1 yahoo.com
$ dig @1.1.1.1 MX nixcraft.com
$ dig @1.1.1.1 AAAA google.co.in

dig command installed on a CentOS 8 Linux and displaying dns output of a query

Testing dig command on an CentOS 8 based cloud server

A tip about finding package names

Want to find out which package owned dig command on an CentOS 8? Try:
$ sudo dnf whatprovides '*bin/dig'
OR
$ sudo yum whatprovides '*bin/host'
Sample outputs:

Last metadata expiration check: 1:03:53 ago on Saturday 28 September 2019 08:07:22 AM UTC.
bind-utils-32:9.11.4-17.P2.el8_0.1.x86_64 : Utilities for querying DNS name
                                          : servers
Repo        : @System
Matched from:
Filename    : /usr/bin/host
 
bind-utils-32:9.11.4-16.P2.el8.x86_64 : Utilities for querying DNS name servers
Repo        : AppStream
Matched from:
Filename    : /usr/bin/host
 
bind-utils-32:9.11.4-17.P2.el8_0.1.x86_64 : Utilities for querying DNS name
                                          : servers
Repo        : AppStream
Matched from:
Filename    : /usr/bin/host
 
bind-utils-32:9.11.4-17.P2.el8_0.x86_64 : Utilities for querying DNS name
                                        : servers
Repo        : AppStream
Matched from:
Filename    : /usr/bin/host

Conclusion

This page showed how to search for dig command package name and install the same on a CentOS 8 based system. See bind project for more info and dig command/host command.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.