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/
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.
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.
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:
This must be typed before any other characters have been entered on the line. Use fg, as usual, to resume the ssh session.
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:
250 2.0.0 Queuing for node yourdomain.example.org started
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.
The password is stored in the password file, which obviously must be kept secure, encrypted later with gpg, deleted, or whatever you prefer.
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.
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.
The J option is a recent addition to GNU tar. The xz compression utility is required as well.
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.
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.)