Find .gm domains with dig

The dig command in Linux and Unix systems is a simple tool for performing DNS lookups from the queried name server. It stand for Domain Information Groper and can be helpful in troubleshooting DNS issues.

In the case of .gm domain registrants, dig can be handy in finding out if the .gm domain you want is taken or not. I find the NIC Gambia website unavailable sometimes or simply slow, making it impossible to use their domain name search form. In addition, the registry lacks a Whois server as well.

To use dig, you need a Linux computer with root or sudo access and of course a terminal. You can use it on Windows computers but this guide focuses on Linux.

First check if dig is installed on your system by running the command:

 dig -v

If it is installed, you will see a terminal output showing the dig version you have installed. If it is not installed you will get an output saying ‘command not found’ and you can go ahead an install dig on your system.


For Debian or a distribution based on the Debian family, use this command:

sudo apt-get install dnsutils


For a CentOS/RedHat system or any of the CentOS offshoot such as AlmaLinux or Rocky Linux, use this command:

sudo yum install bind-utils

Alpine Linux

And on an Alpine machine, you can run the following command.

apk add bind-tools

Now you just need to wait for the installation to finish and you can start using dig to perform DNS lookups.

First lets have a look at the dig syntax so that we know what is what.

dig [DNS_Server] [name] [type]

The firs part of the line is the dig command as you may already know by now. This is followed by the [DNS_Server] your query is directed to. This is optional and if you don’t tell dig to use a specific server, it will resort to using the DNS servers listed in your system’s /etc/resolv.conf file. If no server is found in that file, the program will use the local host. The [name] is the domain name/hostname you are looking up. This can be an IP address if you want. And finally, [type]. This part tells dig to fetch you a particular DNS record, for example, NS. It is also optional and if not specified, dig will perform a query for an A record.

Lets perform a lookup.

dig @ NS

Here we use Google’s public DNS server to perform our query. The @ symbol tells dig this is the server we are directing our query to. The domain we are looking up for is and the type is NS, which means name server.

We have the following out.

; <<>> DiG 9.11.3-1ubuntu1.17-Ubuntu <<>> @ NS
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19900
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

; EDNS: version: 0, flags:; udp: 512
;			IN	NS

;; ANSWER SECTION:		3538	IN	NS		3538	IN	NS		3538	IN	NS		3538	IN	NS

;; Query time: 18 msec
;; WHEN: Wed Jul 27 07:18:45 BST 2022
;; MSG SIZE  rcvd: 120

The first line of the output shows us dig version and the the query we just made. About three lines below that is the ‘HEADER’ section, which shows the information it received from the server. The ‘flags’ tells us the answer format.

The ‘OPT PSEUDOSECTION’ shows more advance data such as Extended DNS if used, flags and UDP packet size.

The QUESTION section display the query information we sent. Next is the ANSWER portion which contain the NS records of

The last section contains the stats, which tells us how long the query took, the DNS sever used in the lookup, the timestamp and size of the reply from the DNS server.

If you don’t fancy seeing all that output, you can use the +short option in your query which output a terse answer instead of the default output. Lets run the same command again with the +short this time.

dig +short @ NS

The output for that command is:

This gives you a much cleaner output which is all you need most of the time. Have a look at the manual pages for dig, it has multiple option which you may find useful.

Doing a .gm domain search with dig

Now that we have an understanding of how dig works, lets look at how we can use it to know if a .gm domain name is taken or is available for registration. The dig command is not the ideal tool you would use to search for domains to register but in the absence of a Whois server from NIC Gambia, we can improvise with a hack.

Lets run our command again, this time with a domain we know is not registered, Per RFC2606, example is a reserved word for documentation.

dig +short @ NS

After running this you will notice no output and you just return to the command prompt. All you do now is us that command replacing example with the actual domain you want to check and register.

Leave a comment

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