Check to make sure the whois nameservers match the nameserver records from the nameservers themselves

domain=google.com; for ns in $(whois $domain | awk -F: '/Name Server/{print $2}'); do echo ">>> Nameservers for $domain from $a <<<"; dig @$ns $domain ns +short; echo; done;
Change the $domain variable to whichever domain you wish to query. Works with the majority of whois info; for some that won't, you may have to compromise: domain=google.com; for a in $(whois $domain | grep "Domain servers in listed order:" --after 3 | grep -v "Domain servers in listed order:"); do echo ">>> Nameservers for $domain from $a Note that this doesn't work as well as the first one; if they have more than 3 nameservers, it won't hit them all. As the summary states, this can be useful for making sure the whois nameservers for a domain match the nameserver records (NS records) from the nameservers themselves.
Sample Output
>>> Nameservers for google.com from NS1.GOOGLE.COM <<<
ns3.google.com.
ns1.google.com.
ns4.google.com.
ns2.google.com.

>>> Nameservers for google.com from NS2.GOOGLE.COM <<<
ns3.google.com.
ns4.google.com.
ns2.google.com.
ns1.google.com.

>>> Nameservers for google.com from NS3.GOOGLE.COM <<<
ns1.google.com.
ns4.google.com.
ns2.google.com.
ns3.google.com.

>>> Nameservers for google.com from NS4.GOOGLE.COM <<<
ns2.google.com.
ns3.google.com.
ns1.google.com.
ns4.google.com.

These Might Interest You

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: