Linux DNS server query tools

Linux command line programLinux has a few Domain Name System (DNS) server query tools that you can access via the command line. You can use these tools to test whether your domain name’s authoritative nameservers are responding correctly or not. Using them you can diagnose problems with DNS records.


Using dig is easy. A simple example to start with:

dig A

In the above example we are querying the nameserver for the A record for the domain name You can use dig to query nameservers for different record types. For example querying a nameserver for the Start of Authority record:

dig soa

Or the NS record:

dig NS

Dig has a lot of options. Type man dig to see the dig help file.


Before dig there was nslookup. It is still available on most Linux distributions as well as on Microsoft Windows. Using nslookup is easy:


The above command will lookup the A record for the domain name at the nameserver

You can also lookup specific record types using the -querytype switch:

nslookup -querytype=mx

Using dig and nslookup you can quickly query DNS servers via the shell.

Leave a Reply

Your email address will not be published. Required fields are marked *