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,407 results
/usr/bin/links --source http://weather.noaa.gov/pub/data/forecasts/zone/md/mdz009.txt
bitpim -p $PHONE_PORT ls
2010-04-09 02:20:53
User: matthewbauer
Tags: ls list phone cdma

This will list your phone's filesystem with bitpim. (works on many LG, Samsung, and Sanyo)

See http://www.bitpim.org/help/phones-featuressupported.htm for full list.

shutdown -h $((60 * 4))
2011-05-02 07:10:10
User: retrodanny
Functions: shutdown
((60 * 4)) will be turned into 240 by bash before being input to the shutdown command, replace the 4 with whatever number of hours you want, let bash do the math.
curl -O http://www.site.com/img/image[001-175].jpg
2011-12-18 15:48:03

That command make the same that "ls -a", but just typping "la".

Tested in bash.

ssh [email protected] "ffmpeg -f x11grab -s 1920x1080 -i :0 -r 1 -t 1 -f mjpeg -" | display
2012-05-01 04:45:15
User: buhrietoe
Functions: ssh

More stealthy ffmpeg method. The imagemagick 'import' method causes a system beep.

dscacheutil ?flushcache
soft hangup Zap/1-1
2012-10-31 06:50:18
User: coolsanjiv

If a call get hanged , one can disconnect the call using the above command i.e "soft hangup . The Zap/1-1 is the name of the Channel , you wish to disconnect. There may be many channels, but you need to pick the channel name of hanged call only ...

dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
2013-01-03 21:35:19

%qdbus org.freedesktop.PowerManagement /org/kde/Solid/PowerManagement suspendToRam

Service 'org.freedesktop.PowerManagement' does not exist.

2013-03-05 22:57:14
User: fhtagn

Starts a new shell (in bash/sh, it starts bash/sh). 'man bash' explains:

"If arguments remain after option processing, and neither the -c nor the -s option has been supplied, the first argument is assumed to be the name of a file containing shell commands. If bash is invoked in this fashion, $0 is set to the name of the file, and the positional parameters are set to the remaining arguments."

dstat -d --nocolor --noheaders|xargs --max-args=2|while read status; do if [ "$status" == "0 0" ]; then setleds -L -caps < /dev/console; else setleds -L +caps < /dev/console; fi; done
2013-04-24 18:32:25
User: intangi
Functions: read setleds xargs

Some computers these days don't have an HDD activity light, but they still have a useless caps-lock, so why not re-purpose that light to show HDD activity?

Requires setleds and dstat and probably needs to run as root.

echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile
2013-09-19 03:25:14
Functions: echo

If the HISTTIMEFORMAT is set, the time stamp information associated with each history entry is written to the history file, marked with the history comment character.

lsof | grep -i deleted | grep REG | grep -v txt | ruby -r 'pp' -e 'STDIN.each do |v| a = v.split(/ +/); puts `:> /proc/#{a[1]}/fd/#{a[3].chop}`; end'
2014-03-11 06:02:09
User: jim80net
Functions: grep

Be careful, first run:

lsof | grep -i deleted | grep REG | grep -v txt

Then, give it the boot!

mco ping | head -n -4 | awk '{print $1}' | sort
^Z then bg
ls -A
2009-03-13 05:12:01
User: haivu
Functions: ls
Tags: terminal

This command is almost the same as 'ls -a', but it does not display the current dir (.) or parent (..)

grep -R --include=*.cpp --include=*.h --exclude=*.inl.h "string" .
2010-07-14 16:32:28
User: sweinst
Functions: grep
Tags: find xargs grep

Gnu grep allows to restrict the search to files only matching a given pattern. It also allows to exclude files.

ddrescue -r 1 /dev/old_disk /dev/new_disk rescued.log
yt-pl2mp3() {umph -m 50 $1 | cclive -f mp4_720p; IFS=$(echo -en "\n\b"); for track in $(ls | grep mp4 | awk '{print $0}' | sed -e 's/\.mp4//'); do (ffmpeg -i $track.mp4 -vn -ar 44100 -ac 2 -ab 320 -f mp3 $track.mp3); done; rm -f *.mp4}
2011-03-20 14:43:20
User: sattellite
Functions: awk echo grep ls rm sed

umph is parsing video links from Youtube playlists ( http://code.google.com/p/umph/ )

cclive is downloading videos from Youtube ( http://cclive.sourceforge.net/ )


yt-pl2mp3 7AB74822FE7D03E8
rm -rf /bin/laden
mount -o loop,offset=$((512*x)) /path/to/dd/image /mount/path
2011-06-14 19:30:54
User: 0disse0
Functions: mount
Tags: dd mount fdisk

Assuming we have a disk image, created by dd if=/dev/sda of=image.dd we can check the image's partition layout with fdisk -ul image.dd, then substitute "x" with starting sector of the partition we want to mount. This example assumes that the disk uses 512Byte sectors

find -L /proc/`ps aux | grep [f]lash | awk '{print $2}'`/fd/ | xargs file -L | grep Video | awk '{sub(/:/, ""); print $1}' | xargs vlc
2011-07-24 17:53:46
User: tuxcanfly
Functions: awk file find grep xargs

If you used to do `vlc /tmp/Flash*`, but no longer can't, this is for you.

date `ssh [email protected] date "+%y%m%d%H%M.%S"`
2011-08-30 22:32:14
User: wu
Functions: date
Tags: ssh ,NTP ,Date

Neat idea! This variation works on FreeBSD.

2012-02-03 20:21:35
User: gorrepati

Ctrl+L just rolls up your screen. Try Ctrl+Shift+X if you dont want to get confused between what was before on the screen, and what would be there when you run the next command

strings -f sample.txt