Checking Domain Age Programatically

You can check the year that a domain was registered with the following command:

whois example.com | grep -i 'creat' | head -n1 | grep -o '[[:digit:]]{4}'

The above line does the following:

  1. The whois command gets the WHOIS record for the domain example.com.
  2. The grep command extracts the line that says Creation date or Creation. The -i option means to search case-insensitively.
  3. head -n1 returns just the first line that matches, otherwise you may end up with two lines matching.
  4. The final grep -o extract just the 4 digits on the line — that should give you the year that the domain was registered.

You can extract the exact day with the following command:

whois example.com | grep -i 'creat' | head -n1 | \
egrep -o '[[:digit:]]{2}-[a-zA-Z0-9]{1,10}-[[:digit:]]{4}'

It works in a similar manner to the first example, but uses a regular expression to extract the full date.

You can also run this on a list of domains in a text file by reading each line of the file.

No votes yet
Syndicate content