Table of Contents
This tip is about the how to Use dig Command on Linux. So read this free guide, How to Use dig Command on Linux step by step. If you have query related to same article you may contact us.
How to Use dig Command on Linux – Guide
Dig (Domain Information Groper) is a command-line utility that performs DNS lookups by querying nameservers and displaying the result. This tutorial covers all the basic uses of the command that you should know about in the Linux operating system. By default, dig sends the DNS request to the nameservers listed in the resolver (/etc/resolv.conf), unless asked to query a specific nameserver.
Dig is part of the DNS utilities package that is usually installed with BIND nameservers. You can also separately install the utilities package that dig includes by accessing your VPS via SSH and using the following commands on the command line: The dig command in Linux is used to collect DNS information. It stands for Domain Information Groper and collects data through domain name servers. The dig command is useful for troubleshooting DNS issues, but it is also used to display DNS information.
Install dig on Linux (optional)
Most modern Linux systems include the dig command. Make sure it is installed by checking the software version. To do this, open a command line and type the following:
The system should respond with a numeric code. If the system cannot find the specified command, install dig by typing the following:
Debian/Ubuntu:
CentOS / Red Hat:
When the installation is finished, verify the installation with the following command:
dig Syntax
The dig command is used as follows:
How to Use dig command with examples
Let’s look at the basic usage of the dig command.
DNS Lookup
The dig command allows you to look up a domain name. To perform a DNS lookup, open the terminal and type:
The most important section is the ANSWER section:
OPT PSEUDOSECTION displays advanced data:
The QUESTION section displays the query data that was submitted:
The STATISTICS section shows metadata about the query:
Specify DNS server
By default, dig uses the local configuration to decide which nameserver to query. Use the following command to specify the Google domain server:
ANY option
To return all query results, use the following:
short answer option
To display only the IP address associated with the domain name, enter the following:
Detailed answer option
Run +noall +answer with the dig command to access detailed information in the answers section
tracking option
The +trace option lists each different server the query passes through to your final destiny. Use this command option to identify the IP address where traffic is falling.
DNS Reverse Lookup
To look up a domain name by its IP address, enter the following:
Final note
I hope you like the guide How to Use dig Command on Linux. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.