Skip to content

Instantly share code, notes, and snippets.

Last active Jul 23, 2021
What would you like to do?
Domain Name Search
# Name: Check for domain name availability (as featured on
# To use this script, add it to your ~/bin directory and make it executable.
# Then you can search for specific domains like this: > my-new-domain
# Alternatively:
# - Generate domain name ideas based on a keyword:
# - Search domain names as you type:
# Please copy, share, redistribute and improve (
if [ "$#" == "0" ]; then
echo "You need tu supply at least one argument!"
exit 1
DOMAINS=( '.com' '.io' )
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"
Copy link

It's be blank. Nothing.

You can easily show something by modifying the "if".


if [ $? -eq 0 ]; then
 echo "$1${DOMAINS[${i}]} - Available"
 echo "$1${DOMAINS[${i}]} - Taken"

Copy link

Appreciate this, was intending to highlight that in the else condition if we can detail out further info regarding the occupancy but this is just fine as well. Also ran my domain day before and found out the rest two - .co & .io were taken up today - bad luck or is this too revealing?

Copy link

whois was throwing an error for newly released TLDs on my old system
getaddrinfo( Name or service not known

so instead I used the less accurate, less detectable host nameserver lookup technique:
host -t ns $1${DOMAINS[${i}]} | egrep -q '^No match|^NOT FOUND|^Not fo|AVAILABLE|^No Data Fou|has not been regi|No entri|not found'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment