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





Maintained by Jon H.

Site originally by David Winterbottom (user root).

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 using gpg from sorted by
Terminal - Commands using gpg - 37 results
nice -n19 dump -0af - /<filesystem> -z9|gpg -e -r <gpg key id>|cstream -v 1 -t 60k|ssh <user@host> "cat > backup.img"
2009-10-29 18:27:25
User: din7
Functions: dump gpg nice ssh

This command will nicely dump a filesystem to STDOUT, compress it, encrypt it with the gpg key of your choice, throttle the the data stream to 60kb/s and finally use ssh to copy the contents to an image on a remote machine.

gpg --allow-multiple-messages --decrypt-files *
2009-09-20 11:50:41
User: bkn390
Functions: gpg

Change directory (cd) to the directory where all your encrypted files are placed, and then run the command - then you are asked to insert your secret gpg password - ubuntu 8.04

echo "SECRET MESSAGE" | gpg -e --armor -s | sendmail USER@DOMAIN.COM
2009-09-04 20:47:12
User: flip387
Functions: echo gpg sendmail

A very simple command to send a signed and encrypted message from the command line using GPG Keys

gpg --search-keys
eval $(sed -n "s/^d[^D]*DB_\([NUPH]\)[ASO].*',[^']*'\([^']*\)'.*/_\1='\2'/p" wp-config.php) && mysqldump --opt --add-drop-table -u$_U -p$_P -h$_H $_N | gpg -er AskApache >`date +%m%d%y-%H%M.$_N.sqls`
2009-08-18 07:03:08
User: AskApache
Functions: eval gpg sed

The coolest way I've found to backup a wordpress mysql database using encryption, and using local variables created directly from the wp-config.php file so that you don't have to type them- which would allow someone sniffing your terminal or viewing your shell history to see your info.

I use a variation of this for my servers that have hundreds of wordpress installs and databases by using a find command for the wp-config.php file and passing that through xargs to my function.

curl -s http://defekt.nl/~jelle/pubkey.asc | gpg --import
2009-06-18 11:26:03
User: wires
Functions: gpg

imports a public key from the web. I know this by head.. but useful nevertheless

tar -cf - folder/ | gpg -c > folder.tpg
2009-05-08 19:20:08
User: copremesis
Functions: gpg tar

gpg's compression is as suitable as gzip's however your backups can now be encrypted.

to extract use:

gpg < folder.tpg | tar -xf -
tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 10 | gpg -e -r medha@nerdish.de > password.gpg
2009-02-25 08:48:26
User: hans
Functions: gpg head tr

Adjust the

head -c

part for password length.

I use filenames like "hans@commandlinefu.com.gpg" and a vim which automatically decrypts files with .gpg suffixes.

gpg --encrypt --recipient 'Foo Bar' foo.txt
2009-02-16 19:58:13
User: mariusz
Functions: gpg

gpg command to encrypt a file on the command line.

gpg --output foo.txt --decrypt foo.txt.pgp
2009-02-16 19:56:19
User: mariusz
Functions: gpg

gpg command to decrypt a previously encrypted file on the command line.

Can be optionally made into an alias:

alias decrypt='gpg --output foo.txt --decrypt foo.txt.pgp'

for x in *.pgp do `cat /file_with_the_passphrase.dat|(gpg --batch --no-tty --yes --passphrase-fd=0 --decrypt `basename $x`; ) > 'dump_content.dat'` done;
gpg --keyserver pgp.surfnet.nl --recv-key 19886493
2009-02-06 02:24:28
User: liupeng
Functions: gpg

get my GPG-key from pgp.surfnet.nl, key id is 19886493.