Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Universal configuration monitoring and system of record for IT.
Hide

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:

Hide

News

May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!
Hide

Top Tags

Hide

Functions

Hide

Credits

Commands using dig from sorted by
Terminal - Commands using dig - 41 results
dig +short @resolver1.opendns.com myip.opendns.com
2010-07-30 15:32:21
User: John_W
Functions: dig
9

Faster than the curl/wget-approaches.

dig +short NS org.
dig +short myip.opendns.com @resolver1.opendns.com
2010-04-02 21:53:26
User: dooblem
Functions: dig
27

Instead of opening your browser, googling "whatismyip"...

Also useful for scripts.

dig can be found in the dnsutils package.

mwiki() { dig +short txt "$*".wp.dg.cx; }
mwiki () { blah=`echo $@ | sed -e 's/ /_/g'`; dig +short txt $blah.wp.dg.cx; }
dig +short myip.opendns.com @resolver1.opendns.com
dig +short -x {ip}
2009-12-21 14:43:35
User: putnamhill
Functions: dig
Tags: IP reverse dig dns
7

The +short option should make dig less chatty.

dig -x {IP}
dig -x 74.125.45.100
2009-09-28 15:13:34
User: postrational
Functions: dig
4

Performs a reverse DNS lookup, variants include:

nslookup 74.125.45.100

or:

host 74.125.45.100
for dnsREC in $(curl -s http://www.iana.org/assignments/dns-parameters |grep -Eo ^[A-Z\.]+\ |sed 's/TYPE//'); do echo -n "$dnsREC " && dig +short $dnsREC IANA.ORG; done
dig google.com
2009-08-28 04:32:52
User: unixbhaskar
Functions: dig
Tags: dns
-1

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.

dig +short $HOSTNAME
dig commandlinefu.com | sed -nr 's/^[^;].*?\s([.0-9]{7,15})$/\1/ p'
2009-08-07 16:11:31
User: birnam
Functions: dig sed
0

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.

dig +short txt <keyword>.wp.dg.cx
2009-07-31 16:08:59
User: drizzt
Functions: dig
211

Query Wikipedia by issuing a DNS query for a TXT record. The TXT record will also include a short URL to the complete corresponding Wikipedia entry.You can also write a little shell script like:

$ cat wikisole.sh

#!/bin/sh

dig +short txt ${1}.wp.dg.cx

and run it like

./wikisole.sh unix

were your first option ($1) will be used as search term.

dig -t txt -c chaos VERSION.BIND @<dns.server.com>
2009-07-30 18:38:39
User: din7
Functions: dig
8

Due to the recent dynamic update vulnerability with bind, I was forced to dig a little deeper into dig...

dig foo.org mx +short