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.


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:



2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.




All commands from sorted by
Terminal - All commands - 11,617 results
alias ll="ls -lh --color=auto"
cd XX YY
2009-02-10 13:20:11
User: yogsototh
Functions: cd

If you are in /begin/path/with/XX/pattern

cd XX YY

will change your current directory to


in ZSH

find . -name "*.java" -exec gnome-terminal \-x vim {} \;
2009-02-10 09:38:04
User: root
Functions: find vim

Not that useful really, more novel. Can open up an awful lot of terminal windows.

find . -name "*.php" -exec php -l {} \; | sed -e "/^No syntax/d"
2009-02-10 09:14:25
User: TomNomNom
Functions: find sed

Uses the PHP binary to check the syntax of all .php files in or below the current working directory. Really handy for doing that last minute check before you commit code to the repository.

sudo date mmddhhxxyyyy
git add -u
ps aux | grep [h]ttpd
2009-02-10 02:59:20
User: abcde
Functions: grep ps

Surround the first letter of what you are grepping with square brackets and you won't have to spawn a second instance of grep -v. You could also use an alias like this (albeit with sed):

alias psgrep='ps aux | grep $(echo $1 | sed "s/^\(.\)/[\1]/g")'

xxdiff -r --exclude=.svn
2009-02-09 23:07:07
User: andrewf

Needs xxdiff installed, which looks a bit clunky but is an extremely powerful graphical diff.

2009-02-09 22:38:56
User: chrisdrew
Functions: script

Creates a log of a session in a file called typescript. Or specify the file with:

script filename

Exit the session with control-d.

ls -R | grep : | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\''
2009-02-09 22:32:01
User: scw
Functions: grep ls sed

Shows the current directory and those below it in a simple tree structure. Recommended use:

alias lt='$command_above'

aticonfig --pplib-cmd "set fanspeed 0 <number>"
grep -lir "text to find" *
sudo date -s "26 OCT 2008 19:30:00"
dvd+rw-format /dev/dvd
wodim -v dev=/dev/dvd -blank=fast
find /dir/ -name *name*
2009-02-09 20:24:10
User: cinan
Functions: find

"*" is important if you don't know exact name of file. Check it out and you'll see

echo 'ibase=10; obase=2; 127' | bc
grep -r "sampleString" . |uniq | cut -d: -f1 | xargs sed -i "/sampleString/d"
2009-02-09 20:21:30
User: sk1418
Functions: cut grep sed xargs

checking files in current and sub directories, finding out the files containing "sampleString" and removing the containing lines from the file.

* Beware that The command will update the original file [no backup].

The command can be extended if play with 'find' command together,

e.g. it is possible to execute on certain type of files: *.xml, *.txt... (find -name "*.xml" | grep....)

if anybody knows a better solution on that, please drop a comment. thx.

poweriso convert image.daa -o image.iso -ot iso
accurev stat -M -fl | awk '{print "\"" $0 "\""}' | xargs accurev pop
git merge-base branch1 branch2
git merge --no-commit --no-ff
2009-02-09 18:59:26
User: Pistos
Functions: merge

Will do the merge, but only apply changes to working copy and index; won't commit.

date -d 09/20/1981 +"%Y-%m-%d"
awk '{ FS = OFS = "#" } { if ($9==1234) print }' filename*.log > bigfile.log