Linux: Bash script to get email address and created/updated/expires dates of domain name
In linux, to check the whois of any domain name, the simple command is:
1 | whois domainname.com |
But, it will show you so many things which are not important, e.g. it will show you the NOTICE and TERMS of USE and so many other things.
If you are only concerned of getting the email address and creation/updation/expiry date of domain name from whois, here is the bash script that will help you out.
First create a bash script file, e.g. whoisEmailAndDates.sh and give it permissions to run:
1 2 | touch whoisEmailAndDates.sh
chmod 744 whoisEmailAndDates.sh |
Now, copy below code and paste it in the newly created file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #!/bin/sh echo "" echo "######## WHOIS: "$1 # Whois using the input variable whois $1 |\ # Remove EOL characters tr -d '\015\032' |\ # Remove leading spaces sed 's/^ *//' |\ # Remove common unnecessary words from output grep -v -e "http://" -e "WHOIS" > wtmp1.txt # Display all of the date lines and email addresses grep -Eio '([[:alnum:]_.]+@[[:alnum:]_]+ ?\.[[:alpha:].]{2,6})' wtmp1.txt egrep -i "ate: " wtmp1.txt # Remove the tmp file rm -rf wtmp1.txt echo "######## DONE!" echo "" |
Now, run the script for the domain:
1 | ./whoisEmailAndDates.sh google.com |
You’ll be greeted with following output!
1 2 3 4 5 6 7 8 9 | ######## WHOIS: google.com admin@google.com admin@google.com admin@google.com admin@google.com Updated Date: 20-jul-2011 Creation Date: 15-sep-1997 Expiration Date: 14-sep-2020 ######## DONE! |
1 Comment
Leave a comment
Welcome to my Blog
Certifications
Honor
Recognition
Contributions
Categories
- Apache (2)
- Domain name (2)
- eCommerce (2)
- htaccess (1)
- Humor (3)
- Instagram API (1)
- jQuery (4)
- JSON (1)
- Linux (10)
- Magento (142)
- Magento admin (58)
- Magento Certification (5)
- Magento error (13)
- Magento frontend (68)
- Magento Imagine (2)
- Magento Interview (5)
- Magento Master (1)
- Magento2 (10)
- Mobile (1)
- MySQL (7)
- OroCRM (2)
- Performance (2)
- PHP (8)
- Prototype JS (3)
- Security (4)
- Wordpress (3)
- XML (2)
Useful Links
Tag Cloud
500 internal server error admin answers attribute bug category checkbox checkout cookie customer difference domain name EAV error event extension interview invoice jquery linux magento magento2 magento admin magento error magento interview questions magento orm mysql observer order pinterest product products questions redirect register remove script session simplexml to array state status study guide tax url wordpress
Great!
A lot simple and better than others!
Thanks a millions!