I have just found a wonderful guide of DNS command at : Linux Web Admin Information

DNS Commands

Zone file database records divide DNS information into three primary types: NS (Name Server) records, MX (Mail Exchange) records, and A (Address) records. NS records indicate the name servers. MX records indicate the hosts that handle email delivery; the priority (pri) number indicates the order in which mail servers are used, with the lowest number receiving the highest priority. The A (Address) records map hostnames to IP addresses, the real names of machines.


The nslookup program allows the user to query Internet domain name servers interactively or non-interactively

# nslookup
> www.redhat.com

Non-authoritative answer:
Name: www.redhat.com
# nslookup www.redhat.com
nslookup interactive options

set querytype=ns

Set the query type to the Name Server record. Future queries of names and IP addresses return the NS record from that host.

set querytype=a
Restore the query type to the Address record.

server server
Make server the default server that is queried.


Use the dig command to determine whether the name server for your domain is configured correctly.

You can quickly determine the Name servers of your host or any other host:
# dig ns your-host.com
Check your (or another) website against the host's name servers:
# dig www.your-domain-name.com @ns.your-host.com
Dig can provide output that is in the same format as the zone file itself. Here is how to get the whole zone file:

# dig any your-domain-name.com
Here are the most useful dig query types: dig any (gathers all DNS information), dig ns (gathers name server information), dig mx (gathers mail exchanger information) and dig a (gathers network address information).

Reverse DNS from command line. Quick and easy way to look up a domain name given an IP address.

# dig -x

This is the simplest of the DNS commands. It is a quick way to determine the IP address of a hostname.

The host command accepts arguments that are either the fully qualified domain name or the IP address of the server when providing results.

# host <FQDN, domain names, host names, or host numbers>

To perfrom reverse lookup

# host 192.1168.52.2
To find all of the information about a host maintained by the DNS, use the command:

# host -a <domain names >
# host -a redhat.com
# host www.your-domain-name.com

The -a option will return all of the DNS information in verbose format:

Now that you know the IP address for www.your-domain-name.com, try a reverse lookup:

# host <IP address>
To list a complete domain, use the command:

# host -l <domain names>
# host -l redhat.com

The dnsquery program queries domain name servers via the resolver library calls /etc/resolv.conf.

# dnsquery <host>
# dnsquery www.redhat.com
Further correction and suggestions are welcome!