How to install dig on RHEL 8 / CentOS 8

The dig DNS lookup utility is an invaluable tool for any system or network administrator. The dig utility can be installed with a single dnf command in case it is currently unavailable on your RHEL 8 / CentOS 8 Linux system.

In this tutorial you will learn:

  • How to install the dig command on Redhat 8.
  • What is the dig command basic usage.

Dig command execution on RHEL 8 Linux Server/Workstation.

Dig command execution on RHEL 8 Linux Server/Workstation.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System RHEL 8 / CentOS 8
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install dig on RHEL 8 / CentOS 8 step by step instructions



  1. To install dig on Red Hat Enterprise Linux 8 execute the following dnf command:
    # dnf install bind-utils
    
  2. Use the -v option to check the installed dig version and correctness of the actual dig installation. For example:
    # dig -v
    DiG 9.11.4-P2-RedHat-9.11.4-14.P2.el8
    
  3. Basic examples of dig command usage

    Check the DNS record for a specific domain. For example check the DNS record for redhat.com:

    # dig redhat.com
    

    Retrieve nameserver IP address for a domain. Example:

    # dig redhat.com +short
    

    Retrieve domain’s DNS records from a specific nameserver. In this example we will retrieve DNS record for domain redhat.com from DNS server 8.8.8.8:

    # dig redhat.com @8.8.8.8
    

    Check domain’s MX records. Example:

    # dig redhat.com MX +short