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,380 results
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

curl ip.telize.com
2014-02-04 12:25:52
User: fcambus

ip.telize.com (Listen on both IPv4 and IPv6)

ip4.telize.com (Listen on IPv4 only)

ip6.telize.com (Listen on IPv6 only)

More information on : http://www.telize.com

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
perl -i -pe "s/old/new/g" *
2009-02-05 12:07:27
User: pandres
Functions: perl

Replaces every ocurrence of 'old' for 'new' in all files specified. After the 'i' char you can put a '~' or whatever to create a backup file for each replaced with the name equal to the original plus character.

sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).in-addr.arpa domain name pointer\(.*\)\./\4.\3.\2.\1\5/' \ lookups.txt
2009-08-22 09:37:20
User: hemanth
Functions: sed
Tags: sed

Reverse DNS lookups, from a file with list of IP's, here the file is called lookups.txt

git branch --contains <commit sha1 id> | sed -e 's/^[ *]*//'