Hide

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.
Hide

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:

Hide

News

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!
Hide

Top Tags

Hide

Functions

Hide

Credits

Commands by kev from sorted by
Terminal - Commands by kev - 116 results
help builtin
ls | vim +'set bt=nowrite' -
xmlstarlet sel -t -c "/path/to/element" file.xml
sudo update-rc.d -f gdm remove
2011-12-16 10:12:21
User: kev
Functions: sudo
Tags: update-rc.d
-2

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

find `pwd` -maxdepth 1 -exec ls --color -d {} \;
scp -l username -pw pa33w0rd file.txt 192.168.1.2:/path/to/dir
cvs up -pA main.cpp | sdiff -s - main.cpp
2011-12-14 04:51:40
User: kev
Functions: cvs sdiff
Tags: cvs
0

you can't reliably use diff against -r HEAD to test whether a file matches the head of the trunk.

identify -format '%w %h %f\n' *.jpg | awk 'NF==3&&$1<500&&$2<500{print $3}' | xargs -r rm
echo 'set term dumb; unset border; unset xtics; unset ytics; p "< seq 10 | shuf" u 1:(rand(0)) w l notitle' | gnuplot
curl -s "http://www.gravatar.com/avatar/`uuidgen | md5sum | awk '{print $1}'`?s=64&d=identicon&r=PG" | display
gnuplot -p <(echo "set style data hist; set xtic rot by -45; plot '<(stat -c \"%n %s\" *)' u 2:xtic(1)")
say() { curl -sA Mozilla -d q=`python3 -c 'from urllib.parse import quote_plus; from sys import stdin; print(quote_plus(stdin.read()[:100]))' <<<"$@"` 'http://translate.google.com/translate_tts' | mpg123 -q -; }
read -s PASS; echo $PASS | convert sensitive.jpg -encipher - -depth 8 png24:hidden.png
2011-11-25 18:15:23
User: kev
Functions: echo read
Tags: ImageMagick
0

Do not use JPEG, GIF, or any other 'lossy' image encoding with Encryption

convert -resize 200 awk.pdf[0] awk.png
import -window `xwininfo | awk '/Window id/{print $4; exit}'` `uuidgen`.png
man -t awk | ps2pdf - awk.pdf
paste <(banner hello,\ ) <(banner world)
2011-11-21 06:38:16
User: kev
Functions: banner paste
Tags: banner
-4

# # ####### # # ####### # # ####### ###### # ######

# # # # # # # # # # # # # # # # #

# # # # # # # # # # # # # # # # #

####### ##### # # # # ### # # # # # ###### # # #

# # # # # # # ### # # # # # # # # # #

# # # # # # # # # # # # # # # # # #

# # ####### ####### ####### ####### # ## ## ####### # # ####### ######

watch -tn1 'date +%T | xargs banner'
2011-11-20 04:46:02
User: kev
Functions: watch xargs
Tags: banner
5

# ### ### # # ### ### # # #

## # # ### # # # # ### ## # #

# # # # ### # # # # ### # # # #

# ### ##### # # #####

# # # ### # # ### # #

# # # ### # # ### # #

##### ### ### # ##### ### ##### #

timeout 5s COMMAND
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
python -c 'import string, random; print "".join(random.choice(string.letters+string.digits) for x in range(6))'
mkpasswd -5 pa33w0rd saltsalt
seq 1 3 20 | sed -n '1{h;d};H;x;s/\n/\t/p' | awk '{printf("%d - %d = %d\n", $2, $1, $2-$1)}'