Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Dig - DNS Querying

Dig is a DNS lookup utility that can be useful for checking your DNS is answering queries correctly.

Install Dig

One can install the dig tool with the following command

sudo apt-get install dnsutils

Query DNS

If you want to query your current default DNS for a hostname, then simply enter the command below:


If you want to query a specific DNS, such as one you just set up, then one needs to specify it like below (substituting the IP):

dig @

Alternatively, you can use a hostname for the nameserver, rather than the IP address, like below:


Example Output

Below is an example of the ouput from such a query.

It may be important to know that the part with ;; Server: is the IP address of the DNS server that responded. This is an easy way to figure out which DNS server you are using if you do not know.

Last updated: 16th August 2018
First published: 16th August 2018