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.

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



Psst. Open beta.

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:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

All commands from sorted by
Terminal - All commands - 12,378 results
curl --basic --user username:password --data status="Twitter from commandline with curl" https://twitter.com/statuses/update.xml
2010-07-06 05:25:51
User: emacs

--basic --user username:password

This will authenticate your Twitter username and password

--data status=""

Send data to the API with POST HTTP form.

lsof | grep 'DEL.*lib' | cut -f 1 -d ' ' | sort -u
2011-05-30 20:45:58
User: leenucks
Functions: cut grep sort

Useful after a complete system update (without a new kernel) when you want to know, which processes need to be restarted

dd if=/dev/zero of=/fs/to/fill/dummy00 bs=8192 count=$(df --block-size=8192 / | awk 'NR!=1 {print $4-100}')
2009-12-03 15:20:18
User: arcege
Functions: awk dd df
Tags: dd df

For disk space constraint testing. Leaves a little space available for creating temp files, etc. Easily free up the used disk space again by deleting the dummy00 file. Can tailor the testing by building smaller 'blocks' to suit the needs of the testing.

WARNING: do not do this to the '/' (root) filesystem unless you know what you are doing... on some systems it could crash the OS.

chmod -R u=rwX,go=rX .
alias ':q'='exit'; alias ':e'='vim';
2012-08-12 12:35:10
User: expelledboy
Functions: alias
Tags: vim alias

This was me just succumbing to the habits, but now I rarely use quit or vim directly, so beware! :)

2009-07-16 08:07:35
User: Blackbit

I don't know why this ain't written as simply as it is. I always see it's just used as parameter, like: vi `!!`

But i use it to repeat a command, as i always work on several shells and check the result of one shell on a second.

response.headers['Cache-Control'] = 'public, max-age=60';
2011-07-11 23:35:36
User: evandrix

possible options:

* Varnish

* Squid in reverse proxy mode

* Django's cache framework

* rack-cache

* or CDN, like Akamai

(Command too long..See sample Output..)
2009-06-14 20:34:37
User: mohan43u
Tags: bash sed echo tr od

curl doesn't provide url-encoding for 'GET' data, it have an option '--data-urlencode', but its only for 'POST' data. Thats why I need to write down this commandline. With 'perl', 'php' and 'python', this is one liner, but just I wrote it for fun. Works in Ubuntu, will work in all linux varients(I hope it will work in unix varients also).

for i in ./*.$1; do mv "$i" `echo $i | tr ' ' '_'`; done for i in ./*.$1; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done for i in ./*.$1; do mv "$i" `echo $i | tr '-' '_'`; done for i in ./*.$1; do mv "$i" `echo $i | tr -s '_' `; done
export PATH=$PATH:`pwd`
2011-02-05 06:29:54
User: YogiBare
Functions: export

This will temporarily add the current directory to your $PATH. Allowing you to execute from that directory for the duration of the session.

tar cvf - /src | ( cd /dest ; tar xvf - )
2011-09-22 15:35:24
User: a8ksh4
Functions: cd tar

This is how I've done it in the past

echo -e "aa\nbb\ncc\ndd\n123" | sed -e :a -e "/$/N; s/\n/;/; ta"
ps ho command $$
echo $SHELL
tar -zcps <dir> -X <(find <dir> -type f -mtime -<days>) |ssh [email protected] tar -xzpsC /data/bkup
2009-02-12 22:31:58
User: zb
Functions: find tar

due to bug can not comment

opendiff <file1> <file2>
2009-06-16 03:22:52
User: claytron

This command will open up the two files in FileMerge on OS X. You can also compare two directories.

opendiff directory1 directory2

NOTE: FileMerge is a part of the OS X Developer Tools, available on the install disc.

rsync --daemon --port 9999 --no-detach -v --config .rsyncd.conf
2011-09-22 20:48:31
User: pykler
Functions: rsync

An example config file is placed in the sample output along with the command line call to use it.

The rsync daemon here is setup on the destination, thus requiring the read only = false flag. Also it uses uid and gid of root, change as required.

exec 3<>/dev/tcp/whatismyip.com/80; echo -e "GET /automation/n09230945.asp HTTP/1.0\r\nHost: whatismyip.com\r\n" >&3; a=( $(cat <&3) ); echo ${a[${#a[*]}-1]};
ifconfig -a|grep Bcast:|cut -d\: -f2|awk '{print $1}'
ps -axgu | cut -f1 -d' ' | sort -u
alias emacs='vim'
ifconfig -a | awk '/Bcast/{print $2}' | cut -c 5-19
wget -O gsplitter.crx "https://clients2.google.com/service/update2/crx?response=redirect&x=id%3Dlnlfpoefmdfplomdfppalohfbmlapjjo%26uc%26lang%3Den-US&prod=chrome&prodversion=8.0.552.224" ; google-chrome --load-extension gspliter.crx
2010-12-14 19:12:18
User: strzel_a
Functions: wget

Download Gsplitter extension, and execute it with Chrome !

Or download it here :


buf () {oldname=$1; if [ "$oldname" != "" ]; then datepart=$(date +%Y-%m-%d); firstpart=`echo $oldname | cut -d "." -f 1`; newname=`echo $oldname | sed s/$firstpart/$firstpart.$datepart/`; cp -i ${oldname} ${newname}; fi }
2010-12-14 19:58:34
User: Seebi
Functions: cp cut date sed

This backup function preserve the file suffix allowing zsh suffix aliases and desktop default actions to work with the backup file too.