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.

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:



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!

Top Tags





Commands by and3k from sorted by
Terminal - Commands by and3k - 5 results
cp "/var/lib/mpd/music/`mpc --format '%file%' | head -n1`" /some/where/else
> filename
emerge -av1 $(for e in `qlist -I --nocolor | uniq`; do for f in `qlist -e $e`; do if test ! -e $f; then echo $e; echo $e: missing $f 1>&2; fi; done; done)
2010-07-04 18:23:59
User: and3k
Functions: echo test

This loops through all installed ebuilds and checks if every file that should be installed is still there and if not adds it to emerge. It includes a verbose output to stderr too.

If you have packages installed that have whitespace in their filenames you have to change the IFS to "newline".

find -type f -exec mv {} . \;
2010-03-02 07:09:45
User: and3k
Functions: find mv

Find every file and move it to current directory.

sed -i 's/oldname@example.com/newname@example.com/g' `grep oldname@example.com -rl .`
2010-02-18 18:26:09
User: and3k
Functions: sed

Do a recursive (-r) search with grep for all files where your old mail address is mentioned (-l shows only the file names) and use sed to replace it with your new address. Works with other search/replacement patterns too.