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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.

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 jasonjgw from sorted by
Terminal - Commands by jasonjgw - 13 results
~ ctrl-z
2010-11-21 07:43:40
User: jasonjgw

This must be typed before any other characters have been entered on the line. Use fg, as usual, to resume the ssh session.

fetchmail -p etrn --fetchdomains yourdomain.example.org secondary-server.example.org
2010-11-20 23:38:09
User: jasonjgw
Functions: fetchmail

This uses fetchmail to issue an etrn command that causes the MTA on the secondary mail server to process the queue for the specified domain.

You can also just use telnet or nc to connect to port 25 of the server and then:

etrn yourdomain.example.org

250 2.0.0 Queuing for node yourdomain.example.org started

find -L -type l
2010-11-20 07:59:58
User: jasonjgw
Functions: find

This is best run as root to avoid permission denials that can produce false positives.

Obviously you can specify a directory in the usual way:

find -L dirname -type l

I can't remember where I read about this or who deserves the credit for it. The find(1) manual page hints strongly toward it, however.

for f in * ; do [ -f $f ] && openssl enc -aes-256-cbc -salt -in $f -out $f.enc -pass file:/tmp/password-file ; done
2010-11-20 03:29:16
User: jasonjgw

The password is stored in the password file, which obviously must be kept secure, encrypted later with gpg, deleted, or whatever you prefer.

To decrypt:

openssl enc -d -aes-256-cbc -salt -in filename.enc -out filename -pass file:/path/to/password-file

Alternative ciphers can be used, of course.

exportfs -o fsid=0,rw :/home/jason
2010-11-18 10:02:52
User: jasonjgw

This exports a directory to the world in read/write mode. It is useful for

quick, temporary NFS exports. Consider restricting the clients to a subnet or

to specific hosts for security reasons (the client can be specified

before the colon).

On the client:

mount -t nfs4 hostname:/ /mountpoint

To terminate all of the exports (after unmounting on the client):

exportfs -u -a

Leave out the fsid=0 option if you don't want NFSv4.

This works under recent versions of Linux.

tar cfJ tarfile.tar.xz pathnames
2010-11-18 05:34:17
User: jasonjgw
Functions: tar

The J option is a recent addition to GNU tar. The xz compression utility is required as well.

ip addr change 2001:db8:1:2::ab dev eth0 preferred_lft 0
2010-11-18 05:05:15
User: jasonjgw

If two or more IPv6 addresses are assigned to an interface, apply this command to all but the address that you want to use as the source address of outbound packets.

This is Linux-specific and requires the iproute package, or equivalent for your distribution.

for f in *.doc ; do wvHtml $f ${f%.doc}.html ; done
2010-11-18 00:20:54
User: jasonjgw

This requires wvWare, which under Debian is in the wv package. Alternative converters can be used, e.g., jodconverter, which uses OO.O instead (no X server need be running.)

mv -i something.conf{,~} && sed "/regexp/s/^/#/" < something.conf~ > something.conf
tar cfz backup-$(date --iso).tar.gz somedirs
detex document.tex|wc -w