Created
October 21, 2019 19:58
-
-
Save ahmadawais/56261539c39a9f66c762989b14c510a4 to your computer and use it in GitHub Desktop.
Check the whois of a domain from the command line.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check the whois of a domain or form a URL. | |
# @usage: whois google.com | |
# @usage: whois https://google.com | |
function whois() { | |
local domain=$(echo "$1" | awk -F/ '{print $3}') # get domain from URL | |
if [ -z $domain ] ; then | |
domain=$1 | |
fi | |
echo "Getting whois record for: $domain …" | |
# Avoid recursion | |
# This is the best whois server AFAIK. | |
# Strip extra fluff | |
/usr/bin/whois -h whois.internic.net $domain | sed '/NOTICE:/q' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment