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





Commands by svg from sorted by
Terminal - Commands by svg - 11 results
echo "This text gets stamped on the top of the pdf pages." | enscript -B -f Courier-Bold16 -o- | ps2pdf - | pdftk input.pdf stamp - output output.pdf
2012-01-03 14:58:10
User: svg
Functions: echo

To quickly add some remark, comment, stamp text, ... on top of (each of) the pages of the input pdf file.

for net in $(ip route show | cut -f1 -d\ | grep -v default); do ipcalc $net | grep Broadcast | cut -d\ -f 2; done
2010-09-28 13:21:31
User: svg
Functions: cut grep route

Can be used in a firewall script, e.g. to avoid logging broadcast packtes.

sudo arp -s 00:35:cf:56:b2:2g temp && ssh root@
2009-09-11 07:49:28
User: svg
Functions: arp ssh sudo

Instead of looking for the right ip address, just pick whatever address you like and set a static ip mapping.

sed '/^#.*DEBUG.*/ s/^#//' $FILE
sed -i 's/^.*DEBUG.*/#&/' $file
pkill $1
2009-07-20 12:47:41
User: svg

There's already a proper command for what the former alternative tried to script

curl -n -d status='Hello from cli' https://twitter.com/statuses/update.xml
2009-07-05 09:39:37
User: svg
Tags: twitter

Update twitter from commandline, without revealing your password and without having to type it interactively.

You 'll need to put a line "machine twitter.com login TWITTERUSER password TWITTERPASS" in $HOME/.netrc and better chmod 600 that file.

for file in `find /var/log/ -type f -size +5000k`; do > $file; done
2009-07-03 17:38:21
User: svg
Functions: file

you don't need to echo, just a plain redirect is enough to empty the file

pdftk $* cat output $merged.pdf
$command 3>&1 1>&2 2>&3
2009-06-09 08:48:08
User: svg

Possible use, to filter something in stderr:

(/usr/bin/$COMMAND $PARAM 3>&1 1>&2 2>&3 | grep -v $uninteresting_error ) 3>&1 1>&2 2>&3

mv $1 $2 && ln -s $2/$(basename $1) $(dirname $1)