Wednesday, January 4, 2012

Script to check whether a list of domain Names are available or not

Script to check whether a list of domains are available or not

Most of the IT professionals are curious  to  check whether there is any domains with interesting names are available with a specified root domain names. I would like to show you a linux  script which will check a list of words one by one and it will check different domain extensions (.net,.com,.org,etc) and it will create an output file with the available domain names .So that we can select some of them found interesting .
This script use a plugin named jwhois

Step 1
Install jwhois
        # yum -y install jwhois  for Redhat and Centos
   #apt-get install whois                                for Ubuntu
  • with this script you can check large number of domain at once
Step 2. Create a directory named scripts
#mkdir script
Step 3
Create a file named domain in the folder script
#cd script
#touch domain
Step 4
Create a file named check.sh and  enter the below lines
#vi check.sh

#!/bin/bash

for j in `cat /root/script/domains`
do
# Add the extentions which all you want to check.I only add 5 as below
DOMAINS=( '.com' '.co' '.in' '.net' '.co.in' )

ELEMENTS=${#DOMAINS[@]}

  for (( i=0;i<$ELEMENTS;i++)); do
      whois $j${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 "$j${DOMAINS[${i}]} : available" >> /root/script/Available.txt
          fi
  done
shift
done

Step 5
Change the script so that it will be excicutable
#chmod 775 check.sh

Please confirm the paths of the file domain and check.sh are correct
Note: Check whether port 43 is open from your Linux machine to internet ,else you need to open the port in the firewall

  • domain name availability checker script
  • domain availability script

No comments:

Post a Comment