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

Commands by dbh from sorted by
Terminal - Commands by dbh - 9 results
less -p pattern file.txt
scanimage -p --resolution 250 --mode Gray -x 215.9 -y 279.4 | pnmtops -imageheight 11 -imagewidth 8.5 | ps2pdf - output.pdf
2013-04-12 18:18:42
User: dbh
Functions: scanimage
Tags: pdf scan scanner

Adjust the --resolution and --mode as required (if these options are available for your scanner).

The size options (-x, -y, -imageheight, -imagewidth) are for US letter paper. For A4, I think the command would be:

scanimage -p --resolution 250 --mode Gray -x 210 -y 297 | pnmtops -imageheight 11.7 -imagewidth 8.3 | ps2pdf - output.pdf
manswitch () { man $1 | less -p "^ +$2"; }
2011-08-19 16:44:48
User: dbh
Functions: less man
Tags: grep switch


manswitch grep -o

This will take you to the relevant part of the man page, so you can see the description of the switch underneath.

sudo bash -c "sleep 1h ; command"
2011-06-15 16:46:31
User: dbh
Functions: bash sudo
sleep 1h ; sudo command


sudo sleep 1h ; sudo command

won't work, because by the time the delay is up, sudo will want your password again.

firefox http://en.wikipedia.org/wiki/$(date +'%b_%d')
quickemail() { echo "$*" | mail -s "$*" [email protected]; }
2011-02-22 20:33:18
User: dbh
Functions: echo mail

I created this so I could send myself an email alert when a long-running job was finished, e.g.,

my_long_job.exe ; quickemail my_long_job.exe has finished
rcsdiff -y myfile
2010-06-14 15:49:42
User: dbh

Use -W to adjust the width of the output, and --suppress-common-lines to show only the lines that have been changed.

sdiff file1 file2
2010-06-14 15:47:12
User: dbh
Functions: sdiff

I found out about this from Unix Power Tools, and thought it was pretty useful.

Use the -w option to change the width of the output, and the -s option to suppress lines that are the same in both files.

alias termsize='echo $COLUMNS x $LINES'