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 by windfold from sorted by
Terminal - Commands by windfold - 5 results
echo -n "password"|md5sum|awk '{print $1}'
2011-11-08 21:34:50
User: windfold
Functions: awk echo
3

This is mostly for my own notes but this command will compute a md5 message digest from the command line.

You can also replace md5sum with other checksum commands (e.g., sha1sum)

find . -exec bash -c "mv '{}' '\`echo {} |sed -e 's/foo/bar/g'\`"' \;
2011-05-07 15:41:07
User: windfold
Functions: bash find
1

This command is a more flexible than my previous submission.

It will work with spaces however suuuuper hacky and ugly.

Source: http://www.unix.com/shell-programming-scripting/146173-find-rename-files-using-find-mv-sed.html

<command>; echo "job done"|mail email@email.com -s'job done'
2011-05-05 18:13:17
User: windfold
Functions: echo mail
5

This is a two part command that comes in really handy if you're running commands that take longer than you're willing to wait. The commands are separated by the semicolon(;) The first command is whatever you're attempting to do. The second commands emails you after the job completes.

ls * | sed -e 'p;s/foo/bar/' | xargs -n2 mv
2011-04-30 00:21:10
User: windfold
Functions: ls sed xargs
3

Renames all files in a directory named foo to bar.

foobar1 gets renamed to barbar1

barfoo2 gets renamed to barbar2

fooobarfoo gets renamed to barobarfoo

NOTE: Will break for files with spaces AND new lines AND for an empty expansion of the glob '*'

svn diff -r 1792:HEAD --summarize | awk '{if ($1 != "D") print $2}'| xargs -I {} tar rf incremental_release.tar {}
2011-04-05 15:00:49
User: windfold
Functions: awk diff tar xargs
Tags: bash svn awk xargs tar
0

The result of this command is a tar with all files that have been modified/added since revision 1792 until HEAD. This command is super useful for incremental releases.