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,410 results
echo $PATH|awk -F: ' { for (i=1; i <= NF; i++) print $i }'
IFS=`echo -en "\n\b"`; for i in $(curl http://feeds.digg.com/digg/container/technology/popular.rss | grep '<title>' | sed -e 's#<[^>]*>##g' | tail -n10); do echo $i; echo $i | sed 's/^/Did you hear about /g' | say; sleep 30; done
2010-06-07 22:16:19
User: echosedawk
Functions: echo grep sed sleep tail
Tags: bash sed curl osx

Instead of having someone else read you the Digg headlines, Have OSX do it. Requires Curl+Sed+Say. This could probably be easily modified to use espeak for Linux.

:bufdo %s/foo/bar/ge | up
dpkg --get-selections | awk '$2=="install" {print $1}' | sort
wget http://www.commandlinefu.com/commands/by/e7__7dal
pacof -e rlogin
2011-11-04 13:17:04
User: pipeliner

Uses dpkg -S or apt-file to find the file you want and shows results in various ways. Available at https://github.com/Pipeliner/configs/blob/master/bin/pacof

pacof -xp 'bin/[^/]*mixer'





find ~/.mozilla -name '*.sqlite' -exec sqlite3 {} VACUUM \;
echo 0 > /proc/sys/kernel/randomize_va_space
2010-07-11 16:42:42
User: gunslinger_
Functions: echo
Tags: kernel

Disable randomisation address

explorer $( cygpath "/path/to/file_or_exe" -w )
2009-07-22 17:00:21
User: Highwayman

This executes faster than


I put this in a script and added it to my path:

cat `which explore.sh`


if [ $# -eq 0 ]; then

explorer.exe $( cygpath `pwd` -w ) &


explorer.exe $( cygpath $1 -w ) &


Using the script you just type

explore.sh file_or_executable

Note: you can do this for any file that has an associated executable in the windows registry. This is quite handy if you want to open pictures or movies from xterm.

col_look(){ column -nts$'\t' "$1" | less -SN#2 }
2015-05-11 18:17:29
User: razerwolf
Functions: column less

Opens up a tab separated file in less with columns printed prettily

PS1='$PWD$ '
2009-02-13 22:00:57
User: Aldiansblog

If you have tried to change your prompt and made a mistake, use this command to retrieve a standard prompt.

If you used the export command when you changed your prompt, also use it there:

export PS1='$PWD$ '

file /music/dir/* | grep -v 44.1 | sed 's/:.*//g' | grep .mp3 | { while IFS= read; do filebak="\"$REPLY.original\""; file="\"$REPLY\""; mv $file $filebak; sox -t mp3 $filebak $file rate 44k; done; };
2010-08-12 21:53:28
User: IgnitionWeb
Functions: file grep mv sed
Tags: mp3 sox resample

This heavy one liner gets all the files in the "/music/dir/" directory and filters for non 44.1 mp3 files. After doing this it passes the names to sox in-order to re-sample those files. The original files are left just in case.

sar -r
2009-05-19 11:47:38
User: sharfah

Report memory and swap space utilization statistics e.g. memory free/used, swap free/used

while killall -USR1 dd; do sleep 5; done
2009-11-09 00:27:33
User: Mikachu
Functions: killall sleep

Stops when the (last) dd process exits.

comm -13 <(sort file1) <(sort file2) > file-new
2011-10-01 18:07:54
User: daa
Functions: comm sort

If both file1 and file2 are already sorted:

comm -13 file1 file2 > file-new

watch -n1 --differences cat /proc/meminfo
hb(){ sed "s/\($*\)/`tput setaf 2;tput setab 0;tput blink`\1`tput sgr0`/gI"; }
2010-04-07 08:45:26
User: AskApache
Functions: sed
hb(){ sed "s/\($*\)/`tput setaf 2;tput setab 0;tput blink`\1`tput sgr0`/gI"; }

hb blinks, hc does a reverse color with background.. both very nice.

hc(){ sed "s/\($*\)/`tput setaf 0;tput setab 6`\1`tput sgr0`/gI"; }

Run this:

command ps -Hacl -F S -A f | hc ".*$PPID.*" | hb ".*$$.*"

Your welcome ;)

From my bash profile - http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html

find / -name FILENAME
sudo scutil --set HostName MY_NEW_HOSTNAME
wget -nd -nH -r -A pdf -I library/mac/documentation/ http://developer.apple.com/library/mac/navigation/#section=Resource%20Types&topic=Reference
2011-10-02 04:56:25
User: GinoMan2440
Functions: wget
Tags: mac os x

download every last pdf reference Doc from the Apple Developer Connection, takes a half hour on a fast connection. enjoy!

git push origin --all
for %%f in (*.json) do type %%f >> aggregate.json
xdg-open $(svn info | sed -n '/URL:/s/URL: //p')
sudo update-rc.d -f gdm remove
2011-12-16 10:12:21
User: kev
Functions: sudo
Tags: update-rc.d

run `sudo update-rc.d gdm defaults` to get it back

wget -qO - snubster.com|sed -n '65p'|awk 'gsub(/<span><br>.*/,"")&&1'|perl -p -e 's:myScroller1.addItem\("<span class=atHeaderOrange>::g;s:</span> <span class=snubFontSmall>::g;s:&quot;:":g;s:^:\n:g;s:$:\n:'
2009-02-18 15:05:13
User: sil
Functions: wget

I've got this posted in one of my .bash_profiles for humor whenever I log in.