What is dig?

nslookup has been deprecated. Use dig to resolve name. dig stands for domain information groper.

How can we use dig with a particular name server?

Use the @ notation to specify the IP address of the name server:

dig @ www.reddit.com

In the above example, we use the name server identified by IP address to look up the IP address of www.reddit.com

How can we use dig to lookup the IP address of a given hostname?

dig +short oracle.com

How can we use dig to lookup the hostname of a given IP address?

dig -x

What is the purpose of the +domain parameter?

The +domain parameter is useful when you are looking for a host inside a domain. For instance, suppose you are searching for the host otn in the oracle.com domain, you can either use:

dig +short otn.oracle.com

Or you can use the +domain parameter:

dig +short +tcp  +domain=oracle.com otn
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License