The following bash script allows user to check for domain name availability using a whois utility ( Domain hijacking made easy ). User needs to only supply single or multiple keywords and the script checks domain availability for each keyword+domain-label. See below for a sample output.

Please feel free to add more generic domain labels into the list. However, test your whois server on what it returns if domain is available as not all whois servers return the exact string. I have tested only domains which are currently in the bash script below. When you get a string which your whois server returns when domain name is available, add it to the script's grep line starting with prefix"|". The chances are that if you add new domain name label the script will just work, but if not you know what to do.

Insert following lines into a file called check-domain-availability.sh


#!/bin/bash # Name: Check for domain name availability # linuxconfig.org # Please copy, share, redistribute and improve if [ "$#" == "0" ]; then echo "You need tu supply at least one argument!" exit 1 fi DOMAINS=( '.com' '.co.uk' '.net' '.info' '.mobi' \ '.org' '.tel' '.biz' '.tv' '.cc' '.eu' '.ru' \ '.in' '.it' '.sk' '.com.au' ) 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

Make script executable:

$ chmod +x check-domain-availability.sh

Execute script:

./check-domain-availability.sh lubos rendek

OUTPUT:

lubos.co.uk : available
lubos.net : available
lubos.mobi : available
lubos.tel : available
lubos.biz : available
lubos.cc : available
lubos.ru : available
lubos.in : available
lubos.it : available
lubos.com.au : available
rendek.co.uk : available
rendek.info : available
rendek.mobi : available
rendek.tel : available
rendek.biz : available
rendek.cc : available
rendek.ru : available
rendek.in : available
rendek.it : available
rendek.com.au : available

Free Linux eBooks

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top