DIG Command cheat sheet

Brian Kepha
2 min readFeb 14, 2024

--

DIG is a flexible tool for interrogating DNS name servers. e.g

dig launchpadkenya.xyz 

which by default returns an A record basically showing you the IP address of your domain name. e.g

What if you wanna query a different record like say a NS record , well just add the record type before the domain name.

dig NS launchpadkenya.xyz 

By default, dig uses the host’s name server ,what if you want to use let’s say google’s public DNS servers? Simply add the DNS server using @ sign

dig @ 8.8.8.8 launchpadkenya.xyz

You noticed the dig command is overly verbose and so you can do away with that and simply return only the records you need by using the command

dig @ 8.8.8.8 ns launchpadkenya.xyz +short

You can also decide to show your output in a more readable format e.g yaml using the command :

dig @ 8.8.8.8 ns launchpadkenya.xyz +yaml

And finally if you wanna see how the recursive name server makes requests to find the record from an authoritative name server use the command

dig @ 8.8.8.8 ns launchpadkenya.xyz  +trace

These are some of the common and useful ways I use dig command. For more information , look in the man pages. Also, if you would like to add to this list, you are free to in the comment section. Thank You.

--

--