Evoke from the command like as:
timeDNS commandlinefu.com
.
This isn't too terribly practical, but it is a good code example of using subshells to run the queries in parallel and the use of an "anonymous function" (a/k/a "inline group") to group i/o.
.
I'm assuming you have already defined your local DNS cache as ${local_DNS}, (here, it's 192.168.0.1).
.
You do need to install `moreutils` to get `sponge`.
.
If you're willing to wait, a slower version w/o sponge, (and w/o sorting), is this:
.
DNS () { for x in "192.168.0.1" "208.67.222.222" "208.67.220.220" "198.153.192.1" "198.153.194.1" "156.154.70.1" "156.154.71.1" "8.8.8.8" "8.8.4.4"; do (echo -n "$x "; dig @"$x" "$*"|grep Query) ; done ; }
Show Sample Output
shorter (thus better ;-) Show Sample Output
Watch a dig in progress Show Sample Output
Strips the non-ip information from the dig output. Could be combined with "head -1" to ensure a single ip is returned. Useful for outputting as a variable for use in scripts. Show Sample Output
This function uses timetrans from the dnssec-tools to calculate the remaining time until a dns entry reaches its time to live and is fetched from the authoritive nameserver again. Show Sample Output
Works for multiple hosts (such as www.google.com) and/or wrong hosts. Show Sample Output
Asks Google what your current IP address is. Bonus: Remove "@ns1.google.com" and you will instead get the IP address of your DNS server.
This command does something similar using dig which is usually more available. Show Sample Output
It is a much better tool then nslookup for getting information about the any site.It has got better capability too.For reverse information please use the switch "-x" and the ip address. Show Sample Output
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.
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
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: