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/
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.
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:
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.
There is 1 alternative - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.
this is awesomely wacky
Vote this up. One can feel the awesome behind this command :-)
cute DNS abuse :)
Very very cool.
We can add some GUI spice to teh absue :P , dep==> zenity
zenity --info --text="$(dig +short txt $(zenity --entry --title="Search wiki" --text="Enter your search word:").wp.dg.cx)"
This is simply awesome. In the shell script example, add quotes around the "${1}" and you can do multi-word searches using quotes in your arg, like:
./wikip.sh "gradient descent"Script with prettified output:
cat wikisole.sh#!/bin/sh
COLUMNS=`tput cols`
dig +short txt "${1}".wp.dg.cx | sed -e 's/" "//g' -e 's/^"//g' -e 's/"$//g' -e 's/ http:/\n\nhttp:/' | fmt -w $COLUMNS
philipsd6's version as a function in bashrc:
function wiki () {
COLUMNS=`tput cols`
dig +short txt ${1}.wp.dg.cx | sed -e 's/" "//g' -e 's/^"//g' -e 's/"$//g' -e 's/ http:/\n\nhttp:/' | fmt -w $COLUMNS
}
You can also search for more than one word like this:
dig +short txt "multiple words".wp.dg.cxI wrote a wrapper script that takes either 1 word or multiple words and formulates the syntax properly:
#!/bin/bash
function help {
echo -e "\n\tusage: $0 "
exit
}
if [ -z "$1" ]; then
help
fi
while [ "$1" != "" ]; do
if [ "$SEARCH" = "" ]; then
SEARCH="$1"
else
SEARCH="$SEARCH $1"
fi
shift
done
echo -e "\n\tLooking up $SEARCH\n"
dig +short txt "$SEARCH".wp.dg.cx
echo ""
I hate dig.
Why not use:
host -t txt linux.wp.dg.cxSimpler multiple words fix:
dig +short txt "`echo $@`".wp.dg.cx
dig +short txt <keyword>.wp.dg.cx | espeakI wonder if we can do that with French language ( fr.wikipedia.org )
Like with this example : fr.wikipedia.org/wiki/Tse
OOps, http://fr.wikipedia.org/wiki/Services_de_terminal
mwiki () { echo $@ > foo; blah=`sed 's/ /_/g' foo`; dig +short txt $blah.wp.dg.cx; }Sample output:
mwiki snow leopard"The snow leopard (Uncia uncia or Panthera uncia), sometimes known as \"ounce,\" is a moderately large cat native to the mountain ranges of Central Asia. The classification of this species has been subject to change and its exact taxonomic position is still " "unclear.