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.
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:
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:
Instead of zeroing the filesystem, this command overwrites N times (default is 3) the disk content, making data recovery much harder.
The command accepts many more options
Make sure the file contents can't be retrieved if anyone gets ahold of your physical hard drive.
With hard drive partition:
gpg --default-recipient-self -o /path/to/encrypted_backup.gpg -e /dev/sdb1 && shred -z /dev/sdb1
WARNING/disclaimer: Be sure you... F&%k it--just don't try this.
This command remove a file from your filesystem like the normal rm command
but instead of deleting only the inode information this also delete the data that was stored on blocks
/!\ warning this may be long for large files
Instead, install apt-get install secure-delete and you can use:
-- srm to delete file and directory on hard disk
-- smem to delete file in RAM
-- sfill to delete "free space" on hard disk
-- sswap to delete all data from swap
This command securely erases all the unused blocks on a partition.
The unused blocks are the "free space" on the partition.
Some of these blocks will contain data from previously deleted files.
You might want to use this if you are given access to an old computer and you do not know its provenance.
The command could be used while booted from a LiveCD to clear freespace space on old HD.
On modern Linux LiveCDs, the "ntfs-3g" system provides ReadWrite access to NTFS partitions thus enabling this method to also be used on Wind'ohs drives.
NB depending on the size of the partition, this command could take a while to complete.
remove file that has sensitive info safely. Overwrites it 33 times with zeros
Shred can be used to shred a given partition or an complete disk. This should insure that not data is left on your disk
GNU shred is provided by the coreutils package on most Linux distribution (meaning, you probably have it installed already), and is capable of wiping a device to DoD standards.
You can give shred any file to destroy, be it your shell history or a block device file (/dev/hdX, for IDE hard drive X, for example). Shred will overwrite the target 25 times by default, but 3 is enough to prevent most recovery, and 7 passes is enough for the US Department of Defense. Use the -n flag to specify the number of passes, and man shred for even more secure erasing fun.
Note that shredding your shell history may not be terribly effective on devices with journaling filesystems, RAID copies or snapshot copies, but if you're wiping a single disk, none of that is a concern. Also, it takes quite a while :)