[Command] Domain summary

I recently started a new job as a sysadmin and technical support specialist. To streamline repetitive tasks, I created handy functions to quickly answer my needs.

For example, to check the information of a domain name, I would simply use the command: g example.com


This script provides:

  • Current DNS record (if not locally propagated) and expected DNS record after propagation.
  • Nameservers for the domain.
  • Key WHOIS information, including expiration date, creation date, last update, status, and registrar details.
# Getting selective informations about a domain
function g() {
  echo "############ nslookup ###############"
  nslookup $1
  echo "############ nameservers ###############"
  dig $1 A +short @8.8.8.8
  dig $1 NS +short @8.8.8.8
  echo "############ WHOIS ###############"
  whois $1 | grep -- 'Expiry\|Creation\|Updated\|Status\|Registrar:'
}

You may add this code to your .bashrc or elsewhere.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *