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,230 results
pkill -9 -u username php5-fcgi
2011-08-09 22:14:21
User: hpavc

Similar commands, same origin.

pgrep [-cflvx] [-d delimiter] [-n|-o] [-P ppid,...] [-g pgrp,...] [-s sid,...] [-u euid,...] [-U uid,...] [-G gid,...] [-t term,...] [pattern]

pkill [-signal] [-fvx] [-n|-o] [-P ppid,...] [-g pgrp,...] [-s sid,...] [-u euid,...] [-U uid,...] [-G gid,...] [-t term,...] [pattern]

sudo chown -R nobody:admin /Applications/XAMPP/xamppfiles/htdocs/
sed G
2009-05-02 12:11:40
Functions: sed

G option cause a file to be spacing line by line.

awk 'BEGIN{dir=DIR?DIR:ENVIRON["PWD"];l=split(dir,parts,"/");last="";for(i=1;i<l+1;i++){d=last"/"parts[i];gsub("//","/",d);system("ls -ld \""d"\"");last=d}}'
2009-10-22 16:28:07
User: arcege
Functions: awk

Handled all within awk. Takes the value from $PWD and constructs directory structures and runs commands against them. The gsub() call is not necessary, but added for better visibility.

If a variable DIR is given on the awk command-line, then that directory is used instead:

awk -vDIR=$HOME/.ssh 'BEGIN{dir=DIR?...}'
cat /proc/meminfo
cd $(ls -ltr|grep ^d|head -1|sed 's:.*\ ::g'|tail -1)
2011-08-10 03:39:35
Functions: cd grep head ls sed tail

Replace the head -1 with head -n that is the n-th item you want to go to.

Replace the head with tail, go to the last dir you listed.

You also can change the parameters of ls.

find -type f | xargs ls -1tr
$ssh-copy-id ptaduri@c3pusas1
sudo urlsnarf -i wlan0
cat large.xml | xclip
2009-07-08 16:30:07
User: copremesis
Functions: cat

avoid mouse abuse and the constant struggle of balancing scroll velocity ... not to mention that burning sensation in your upper right shoulder ....

ssh-keygen ptaduri@c3pusas1
parallel -a <(seq 0 20) mkdir /tmp/dir1/{}
echo lowercaseword | tr '[a-z]' '[A-Z]'
rename s/ .php/ .html/ *.html
hashalot -s salt -x sha256 <<<"test"
2010-11-30 19:32:29
User: vayn
Tags: hash

It's inspired by Generate MD5 hash for a string() [ http://goo.gl/ObCrl ], you need to install hashalot(very small) first. Salt is not necessary.

There is an optional command:

sha256 -s salt -x <<<"test"
mtr google.com
2012-02-19 22:27:48
User: d_voge

You need to have mtr installed on your host.

alias mplayer='mplayer -stop-xscreensaver'
host google.com|awk '{print $NF}'
cat /dev/sda | pv -r > /dev/null
2011-01-23 22:58:56
User: kerim
Functions: cat

Change your drive letter as you wish.

Using pv command for speed detect.First of all you must install pv command for usage.



find . -type f -iname '*.java.orig' -delete
find . -printf "%T@ %p\n" | sed -e 1d | while read ts fn; do ts=${ts%.*}; if [ $ts -ge ${gts:-0} ]; then gts=$ts; echo `date -d @$gts` $fn; fi; done
2009-08-19 11:59:22
User: slim

Whereas ^V is CTRL-V.

converts a dos file to unix by removing 0x13 characters

ifconfig eth0 | perl -ne 'print $1 if m/addr:((?:\d+\.){3}\d+)/'