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

last updated in Categories , ,

I deployed minimal version of RHEL 8 in the cloud. However, I am unable to find the dig command on my newly created RHEL 8 server. It says ‘-bash: dig: command not found‘ I tried yum install dig, but it failed too. How do I install dig command on RHEL 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 RHEL 8 using the bash shell. You must log in as root user to install the following package.

RHEL 8 dig command not found

You may get the following error when you run dig command:
$ dig www.nixcraft.com
$ 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"
RHEL 8 dig command not found

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

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 RHEL 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.

How to install dig on RHEL 8

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

How to install dig on RHEL 8 using dnf command
Installing the dig command on an RHEL 8 server

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

The syntax is:
dig Hostname
dig DomaiNameHere
dig @DNS-server-name Hostname
dig @DNS-server-name IPAddress
dig @DNS-server-name Hostname|IPAddress type

For example:
$ dig www.nixcraft.com
$ dig @ google.com
$ dig @ MX nixcraft.com
$ dig @ AAAA yahoo.com

dig command installed on an RHEL 8 and displaying dns output of a query
Testing dig command on an RHEL 8 based system

A tip about finding package names

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

Updating Subscription Management repositories.
Updating Subscription Management repositories.
Last metadata expiration check: 0:55:14 ago on Sunday 02 December 2018 01:52:46 AM IST.
bind-utils-32:9.11.4-14.P2.el8.x86_64 : Utilities for querying DNS name servers
Repo        : @System
Matched from:
Other       : *bin/dig
bind-utils-32:9.11.4-14.P2.el8.x86_64 : Utilities for querying DNS name servers
Repo        : rhel-8-for-x86_64-appstream-beta-rpms
Matched from:
Other       : *bin/dig


This page showed how to search for dig command package name and install the same on an RHEL 8 based system.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.