How to install and use the dig and nslookup command in Linux

In this article, you will learn how to install and dig command nslookup command on Linux. These commands are used for network troubleshooting and collect information about domain names.

Domain Information Gopher Dig is an abbreviation, a DNS lookup utility used to detect and resolve issues related to DNS servers and DNS servers. Because of its ease of use, system administrators rely on this tool to troubleshoot DNS issues.

Nslookup DNS lookup for processing and display important information such as the IP address of the MX records and domain name associated with.

Newer Linux system default while providing dig and nslookup utility. However, older Linux systems may not. Both bind-utils bundled package.

Let's see how to install DNS troubleshooting utilities in Linux.

Dig & nslookup mounted in / RHEL in

# dnf install bind-utils

How to install and use the dig and nslookup command in Linux

After a successful installation, use the following command to verify the version.

# You -v

How to install and use the dig and nslookup command in Linux

On Debian and any derivatives (including Debian), using the command apt to complete the installation.

# apt install dnsutils

Similarly, to verify the installation, run the command.

# You -v

Installation dig & nslookup on ArchLinux

For ArchLinux, will be installed dig and nslookup commands.

# Pacman -Sy dnsutils

To check the version of dig installed, run.

# You -v

Use the dig command

dig command can be used to query and retrieve the domain name information as follows:

How to install and use the dig and nslookup command in Linux

This command displays a lot of information, e.g. dig command version of the utility, DNS server, and the corresponding IP address.

Sample Output

;; Query time: 27 msec
;; SERVER: 192.168.229.2#53(192.168.229.2)
;; WHEN: 三 11月 27 06:01:38 EST 2019
;; MSG SIZE  rcvd: 73

To be more specific and displays only the IP domain, append + short parameter as follows:

How to install and use the dig and nslookup command in Linux

To check the MX records for the domain name, please run.

How to install and use the dig and nslookup command in Linux

Use nslookup command

To use the nslookup utility to retrieve information about the domain name, use the following command.

Sample Output

How to install and use the dig and nslookup command in Linux

to sum up

In this article, you learned how to install basic usage in different Linux distributions dig and nslookup command utilities, and commands. We do hope that you can now easily install the utility system in the face of no utility.

Guess you like

Origin www.linuxidc.com/Linux/2019-11/161600.htm