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





All commands from sorted by
Terminal - All commands - 12,232 results
VBoxManage list systemproperties
2010-04-23 06:43:49
User: 0disse0
Tags: virtualbox

How to show the system properties of a Sun VirtualBox server

wget --quiet -O - checkip.dyndns.org | sed -e 's/[^:]*: //' -e 's/<.*$//'
2010-08-01 13:36:08
User: berkes
Functions: sed wget
Tags: ip address

Wgets "whatismyip" from checkip.dyndns.org and filters out the actual IP-adress. Usefull when you quickly need to find the outward facting IP-address of your current location.

exiv2 *JPG | grep Focal | awk '{print $5}' | sort -n | uniq -c
2011-07-05 11:25:29
User: ivanatora
Functions: awk grep sort uniq

First column is number of photos, second column is the focal length.

pdfcrack <FILE>
find /var/www/ -type f -print0 | xargs -0 chmod 644
2013-03-28 11:10:30
User: FiloSottile
Functions: chmod find xargs
Tags: find xargs chmod

xargs is a more elegant approach to executing a command on find results then -exec as -exec is meant as a filtering flag.

pandoc --from=markdown --to=rst --output=README.rst README.md
expanded_script=$(eval "echo \"$(cat ${sed_script_file})\"") && sed -e "${expanded_script}" your_input_file
2009-05-07 14:21:14
Functions: eval sed

With this command you can use shell variables inside sed scripts.

This is useful if the script MUST remain in an external file, otherwise you can simply use an inline -e argument to sed.

STAT=`curl http://www.whatismyip.org/`; curl -u YourUserName:YourPassword -d status=$STAT http://twitter.com/statuses/update.xml
2009-10-26 23:02:30
User: m33600

Easy way to find your computers IP in one place, ie, twitter

It suppress the need of dyndns clients and remembering the complex names they give you.

I put it inside KAlarm ( the cron GUI for KDE, ubuntu), to update my ip every 3 minutes.

I did not add the cron statements to keep the code clean.

VBoxManage showvminfo "cicciobox" --details
2010-04-23 06:45:29
User: 0disse0
Tags: virtualbox

where "cicciobox" is the name of your virtual machine in a Sun VirtualBox server

zip -r homard homard -x homard/.git\*; cp ./homard.zip /path_to_dropbox_public_folder/homard.zip
2010-06-30 22:19:39
User: juliend2
Functions: cp
Tags: git zip dropbox

If like me you do a lot of front-end coding and you have a lot of clients that asks you some little modifications, then you send the modifications back to them in a zip file while ignoring the .git folder and .gitignore file, then copy this zip into your dropbox and send it back to them. They find out a new bug so, rince and repeat? You get the picture. It can be quite tedious.

alias duh='dulist=$(du -sh */); for i in T G M K; do printf "$dulist"|egrep "^[0-9\.]+$i" | sort -rn; done'
2010-12-07 11:11:26
User: forcefsck
Functions: alias du egrep printf sort
Tags: disk usage

Alias to produce a list of all subdir sizes in current dir, in reverse order and human readable units. du is executed only once. Remove the slash after the asterisk to include files.

echo -n "String to get MD5" | md5sum | sed "s/ -//"
diskutil list
nohup exemplo.sh &
find /dev/vg00 -type b -exec lvextend -m 1 {} /dev/disk/<disk> \;
2010-02-24 18:41:33
User: Glip
Functions: find
Tags: hp-ux lvm

Mirror every lvol in vg00 in hp-ux 11.31

VBoxManage list ostypes
2010-04-23 06:50:42
User: 0disse0

If you want to know what OS are supported on "guest" machines on the Sun VirtualBox server.

mplayer -vo fbdev $1 -fs -subcp ${2:-cp1251} -vf scale=${3:-1280:720}
2011-03-04 00:55:55
User: vkolev

It's made for a script use, where you have 3 parameters:

1. parameter is the filename

2. (optional) the encoding for subtitles

3. (optional) the scaling of the video, since fullscreen doesn't mean that the video will be scaled.

tail -f ~/.bash_history
2011-09-15 19:35:09
User: totti
Functions: tail
Tags: watch

Changes are displayed when they are written to the file

to exit

gnome-open .
VBoxManage createvm --name "vm-name" --ostype Ubuntu --register
find . -type f | xargs ls -ltrhg
2010-05-28 01:23:53
User: emacs
Functions: find ls xargs

find and normal files and list them sorting with modification time without group

l: with detailed information

t: sort with modification time

r: reverse order

h: show file's size in human-readable format, such as K(kilobytes), M(megabyes) etc.

g: do not show group

find . -type d -execdir du -sh '{}' ';' | grep -E "[0-9]+K" | sed 's/^[0-9\.]\+K[\t ]\+//' | tr "\n" "\0" | xargs -0 rm -rf
echo Faltan `curl http://www.elproximoferiado.com.ar/index.php?country=AR -silent | grep contador | cut -f2 -d">" | cut -f1 -d"<"` dias para el proximo feriado
curl "http://api.twitter.com/1/statuses/user_timeline.xml?count=1&screen_name=barackobama" | egrep -w "<text>(.*)</text>" | sed -E "s/<\/?text>//g" | say
2012-02-27 18:46:33
User: beerdeaap
Functions: egrep sed
Tags: twitter osx say

speaks out last twitter update using 'say'

ls -1 | while read file; do new_file=$(echo $file | sed s/\ /_/g); mv "$file" "$new_file"; done