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.
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.
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:
Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:
Though without infinite time and knowledge of how the site will be designed in the future this may stop working, it still will serve as a simple straight forward starting point.
This uses the observation that the only item marked as strong on the page is the single logical line that includes the italicized fact.
If future revisions of the page show failure, or intermittent failure, one may simply alter the above to read.
wget randomfunfacts.com -O - 2>/dev/null | tee lastfact | grep \<strong\> | sed "s;^.*<i>\(.*\)</i>.*$;\1;"
The file lastfact, can then be examined whenever the command fails.
Spelling Suggestion using Yahoo! API
Prints a log of phonecalls placed from/to an asterisk server, formated into an easily readable table.
You can use partial number/queue matches, or use .* to match everything.
use curl and sed to shorten an url via goo.gl
Use color escape sequences and sed to colorize the output of svn stat -u.
svn stat characters: http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.ref.svn.c.status
GNU Extensions for Escapes in Regular Expressions: http://www.gnu.org/software/sed/manual/html_node/Escapes.html
This doesn't make any assumptions about your IP address and prints out one IP address per line if you have multiple network interfaces.
This assumes your local ip starts with 192.something (e.g. 192.168), it greps ifconfig output for an ip that starts with 192, then strips the extra garbage (besides the ip)
Maybe `ifconfig | grep addr | grep Bcast` would also do it
Here "^M" is NOT "SHIFT+6" and "M". Type CTRL+V+M to get it instead.
Its shortest and easy. And its sed!, which is available by default in all linux flavours.. no need to install extra tools like fromdos.
Will edit *.db files in the same directory with todays date. Useful for doing a mass update to domains on a nameserver, adding spf records, etc.
Looks for a string starting with 200 or 201 followed by 7 numbers, and replaces with todays date. This won't overwrite Ip's but i would still do some double checking after running this.
Make sure your server's date is correct, otherwise insert your own serial number.
should usually follow this command.
get a list of currently running oracle dbs (identified by the pmon process)
show the executable that spawned the process and
show the ORACLE_HOME relative to the environment within which the process is running
tailored to AIX (sed on linux behaves...differently)
suggestions for a better way...please.
This works in Mac OS X (10.6.2) (natively comes with curl)
usage: currency_convert $1(amount) $2(from_denomination) $3(to_denomination)
currency_convert 1 usd inr
This will fetch a metascore from metacritic.com.
It requires a url from metacritic without the http://www.metacritic.com/
Would be cool to use this in some sort of a graph.
You think Expansys in all these countries will sell the HTC Desire for the same price? Well, you'll be surprised. Most of them will be sold at 499.99 EUR but the cheapest can be found in Germany and the most expensive, in Belgium.
specially usefull for sql scripts with insert / update statements, to add a commit command after n statements executed.
This one uses dictionary.com
translate <phrase> <source-language> <output-language>
works from command line
The original was a little bit too complicated for me. This one does not use any variables.
Looks up a word on merriam-webster.com, does a screen scrape for the FIRST audio pronunciation and plays it.
USAGE: Put this one-liner into a shell script (e.g., ~/bin/pronounce) and run it from the command line giving it the word to say:
If the word isn't found in merriam-webster, no audio is played and the script returns an error value. However, M-W is a fairly complete dictionary (better than howjsay.com which won't let you hear how to pronounce naughty words).
ASSUMPTIONS: GNU's sed (which supports -r for extended regular expressions) and Linux's aplay. Aplay can be replaced by any program that can play .WAV files from stdin.
KNOWN BUGS: only the FIRST pronunciation is played, which is problematic if you wanted a particular form (plural, adjectival, etc) of the word. For example, if you run this:
you'll hear a voice saying "onomatopoeia".
Playing the correct form of the word is possible, but doing so might make the screen scraper even more fragile than it already is. (The slightest change to the format of m-w.com could break it).