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 bugmenot from sorted by
Terminal - Commands by bugmenot - 57 results
cat file.txt | grep -v /$ > newfile.txt
dd if=mybackup.ab bs=24 skip=1 | openssl zlib -d > mybackup.tar
dd.exe --progress if=\\.\Volume{0b1a0cbe-11da-11c0-ab53-003045c00008} of=pendrive.img
2012-10-13 08:25:48
User: bugmenot
Functions: dd

Blocksize (bs) is not mandatory. It's only needed when the count option is specified.

xterm +u8 -fn mtx -maximized -T "There is no spoon!" -e cmatrix -bxa -u 3 & sleep .1s && wmctrl -r :ACTIVE: -b add,fullscreen && transset-df -a &
2012-09-28 04:46:28
User: bugmenot
Functions: sleep
apt-get install cmatrix cmatrix-xfont wmctrl transset-df

Need to restart computer for mtx font to work

Commands while cmatrix is running:

1 - 9 = Change speed

SHIFT + 1 - 7 = change colors

Q = Quit

Tested in Ubuntu 10.04

find ./ -empty -type d -delete
find ./ -empty -type d -print
find ./ -maxdepth 1 -empty -type d -delete
find ./ -maxdepth 1 -empty -type d -print
rd /S /Q directory
sudo shred -vz -n 0 /dev/sdb
dir /ad /s /b
pv /dev/urandom -L 3m -i 0.3 > /dev/null
2012-07-29 00:46:09
User: bugmenot

-L RATE, --rate-limit RATE

Limit the transfer to a maximum of RATE bytes per second. A suffix of "k", "m", "g", or "t" can be added to denote kilobytes (*1024), megabytes, and so on. It must be an integer.

find path -name '*' -type f | pax -wd > txtarchive.tar
2012-07-29 00:44:51
User: bugmenot
Functions: find pax

NOTE that pax goes always recursively, for that reason -d option should be added when you don't want to go recursively into directories.

find path -name '*' -type f | cpio -ov -H ustar -F txtarchive.tar
cat /dev/urandom | pv -L 3m | dd bs=1M count=100 iflag=fullblock > /dev/null
2012-07-29 00:42:16
User: bugmenot
Functions: cat dd

This example will close the pipe after transferring 100MB at a speed of 3MB per second.

find . -name '*' -type f -print0 | xargs -0 grep -n pattern1 | grep pattern2
2012-07-29 00:40:06
User: bugmenot
Functions: find grep xargs

The option -print0 for find and -0 for grep help prevent issue with weird characters or spaces in filenames. Furthermore with xargs there is no limited number of arguments that find can throw.

watch -n10 "if test -e run.txt ; then chmod +x script.sh && ./script.sh && rm run.txt || rm run.txt && echo > failed.txt ; fi"
2012-07-29 00:38:08
User: bugmenot
Functions: watch

You can upload via ftp the script.sh in unix text format, and then upload a file called run.txt to execute once the script. Such script can be multiline. If the script fails a failed.txt will be generated that you can see via ftp.

find ./ -type f -name "*.txt" -exec tar uvf myarchives.tar {} +
2012-07-29 00:35:58
User: bugmenot
Functions: find tar

Note: the tar archive must not exist in order to create it. If exists it will only be updated and no already existent files in present search will still remain in the tar archive. The update option has to be used instead of create because the command tar may be executed more than once depending on the number of arguments that find throws. You can see maximum number of arguments with 'getconf ARG_MAX'

mkfifo foo ; nc -lk 2600 0<foo | /bin/bash 1>foo
2012-07-29 00:33:41
User: bugmenot
Functions: mkfifo

Then just nc servername 2600 and ./script.sh

kill the client with ctrl+c. You can reconnect several times.

kill the server with exit

export PATH= $(echo $PATH | tr ':' '\n' | awk '!/matching string/' | paste -sd:)
grep "\-\-" file
fdupes -r -1 Neu | while read line; do j="0"; buf=""; for file in ${line[*]}; do if [ "$j" == "0" ]; then j="1"; buf=$file; else ln -f $buf $file; fi; done; done
killall -u username
read -s pass; echo $pass | md5sum | base64 | cut -c -16
2011-11-24 20:23:47
User: bugmenot
Functions: cut echo md5sum read

Why remember? Generate!

Up to 48 chars, works on any unix-like system (NB: BSD use md5 instead of md5sum)

scrot -s /tmp/file.png
2011-11-24 20:00:13
User: bugmenot
Tags: scrot

I think, this is a shorter one :)