Nov 2, 2012
kalpesh

Linux: Bash script to check availability of domain names in differnet TLDs

If you want to check whether your desired domain name is available or not in different extensions, it’s tiresome to search it for each and every tld. There are also limits of performing query to whois on websites, where they will not allow you unlimited whois information queries. It’s better to have your own script which will tell you the availibility of domain name in different extensions, right from your terminal.

Below script will check your domain name for TLDs .com, .net, .org, .info, .us, .co, .tel, .tv, .biz, .cc, .ru, .eu, .in, .it, .sk, .com.au, .sh, .re and .dk
But you can add other TLDs also if you want.

First create a file, e.g. chkWhois.sh, and give it proper permission to execute.

touch chkWhois.sh
chmod 744 chkWhois.sh

Now, copy below code to this newly created file

#!/bin/bash 

if [ "$#" == "0" ]; then
    echo "You need to supply at least one domain name!" 
    exit 1
fi

DOMAINS=( '.com' '.net' '.info' '.us' '.co' \ 
'.org' '.tel' '.biz' '.tv' '.cc' '.eu' '.ru' \ 
'.in' '.it' '.sk' '.com.au' '.sh' '.re' '.dk' )

ELEMENTS=${#DOMAINS[@]}

while (( "$#" )); do

  for (( i=0;i<$ELEMENTS;i++)); do
      whois $1${DOMAINS[${i}]} | egrep -q '^No match|^NOT FOUND|^Not fo|AVAILABLE|^No Data Fou|has not been regi|No entri'
          if [ $? -eq 0 ]; then
              echo "$1${DOMAINS[${i}]} : available" 
          fi
  done

shift

done

Run this for your desired name to check,

./chkWhois.sh kalpesh

You’ll get output will all the TLD’s your name is available for!

kalpesh.us : available
kalpesh.tel : available
kalpesh.cc : available
kalpesh.eu : available
kalpesh.ru : available
kalpesh.sk : available
kalpesh.sh : available
kalpesh.re : available
kalpesh.dk : available

Have fun!

1 Comment

  • Do you have a script to debug urls lists (domains), and comparing it with ccTLD, ccSLD, sTLD, utld, gSLD, gTLD Domains Hack, etc ?
    (and do you have a script or a list with all domains ccTLD, ccSLD, sTLD, utld, gSLD, gTLD Domains Hack?
    Thanks a lot

Leave a comment

 

Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!

Certifications

Honor

Recognition

Magento top 50 contributors

Magento top 50 contributors

Contributions