Dig is a great tool, but most of its output is not very interesting. There are a bunch of command line options that I can never remember without a quick 'man dig' which always sounds a bit odd. So I whipped up a quick script. It takes a domain name as the argument, and then pumps out the Reverse IP lookup, Nameservers, and Mail servers with reverse lookup of their IPs.
#!/bin/bash
QUERYDOMAIN=$1
echo "Reverse IP:" echo " " `dig x +short $QUERYDOMAIN` echo "Nameservers" NAMESERVERS=`dig ns +short $QUERYDOMAIN | sed "s/^[0-9]* //g"` for SERVER in $NAMESERVERS; do echo " " $SERVER " = " `dig x +short $SERVER`; done echo "Mail Servers:" MAILSERVERS=`dig mx +short $QUERYDOMAIN | sed "s/^[0-9]* //g"` for SERVER in $MAILSERVERS; do echo " " $SERVER " = " `dig x +short $SERVER`; done
The output looks like this: