• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

dig: command not found

by admin

A powerful tool for gathering information and testing name resolution. It is installed on most Linux distributions. Output is displayed in an answer section. The output will include the IP address mapped to the domain name, the DNS server that answered the query, and how long it took to receive that answer.

Syntax

The basic syntax is:

# dig {domain name}

The command dig @{IP address} {domain name} will resolve the domain name against the DNS server specified by the IP address.

If you encounter the below error while running the dig command:

dig: command not found

you may try installing the below package as per your choice of distribution:

OS Distribution Command
Debian apt-get install knot-dnsutils
Ubuntu apt-get install knot-dnsutils
Alpine apk add bind-tools
Arch Linux pacman -S bind-tools
Kali Linux apt-get install dnsutils
Fedora dnf install bind-utils
Raspbian apt-get install knot-dnsutils

dig Command Examples

1. To dig into any domain name server:

# dig centos.com

2. To hide any particular section from the output:

# dig centos.com +noanswer
# dig centos.com +noadditional 
# dig centos.com +nostats
# dig centos.com +noauthority
# dig centos.com +nocomments

3. To query all types of records:

# dig centos.com -t ANY

4. To query MX records (Mail Exchanger records):

# dig centos.com MX
# dig centos.com -t MX

5. To query SIG records (Signature Records):

# dig centos.com -t SIG

6. To query NS records (Name server records):

# dig centos.com -t NS

7. To query TXT records (Text records):

# dig centos.com -t TXT

8. To see the summarized output:

# dig centos.com +short

9. To do the reverse DNS lookup of the server:

# dig -x centos.com

10. Perform iterative queries and display the entire trace path to resolve a domain name:

# dig +trace example.com

11. Find authoritative name servers for the zone and display SOA records:

# dig +nssearch example.com

12. Query a specific DNS record type associated with a given domain name:

# dig +short example.com A|MX|TXT|CNAME|NS

13. Lookup the IP(s) associated with a hostname (A records):

# dig +short example.com

14. Get a detailed answer for a given domain (A records):

# dig +noall +answer example.com

Filed Under: Linux

Some more articles you might also be interested in …

  1. who Command Examples in Linux
  2. Understanding The /proc File System
  3. kscreen-doctor : command not found
  4. mkfs.fat: command not found
  5. How To Configure 802.1q VLAN On NIC On CentOS/RHEL 7 and 8
  6. cpufreq-aperf Command Examples in Linux
  7. awk: command not found
  8. kpartx Command Examples in Linux
  9. How to change the number of commands stored in Bash History
  10. asterisk: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright