×

This article covers how to query various DNS records. The dig command in Linux is used to gather DNS information. It stands for Domain Information Groper, and it collects data about Domain Name Servers. The dig command is helpful for diagnosing DNS problems, but is also used to display DNS information.

By default, dig sends the DNS query to name servers listed in the resolver(/etc/resolv.conf) unless it is asked to query a specific name server.


How to Install Dig on Linux ?

1. On Debian and Ubuntu, run:

$ apt-get install dnsutils

2. On CentOS 7, run the command:

$ yum install bind-utils

3. Once installed, check the version, to make sure the setup was completed successfully:

$ dig -v


Dig Syntax

In its simplest form, the syntax of the dig utility will look like this:

dig [server] [name] [type]


i. [server] – the IP address or hostname of the name server to query.

If the server argument is the hostname then dig will resolve the hostname before proceeding with querying the name server.

It is optional and if you don't provide a server argument then dig uses the name server listed in /etc/resolv.conf.

ii. [name] – the name of the resource record that is to be looked up.

iii. [type] – the type of query requested by dig. For example, it can be an A record, MX record, SOA record or any other types.

By default dig performs a lookup for an A record if no type argument is specified.




More Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on IbmiMedia.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com