Aliasing commands is one of the most useful tools for automating important, difficult-to-remember tasks.

Here’s one I keep around for the right moment for my Mac:

alias feds-are-here='diskutil list | grep /dev | sort -r | \
                     xargs diskutil secureErase 1'

Or if I’m at my Linux box:

alias feds-are-here="fdisk -l | grep 'Disk /' | sort -r | \ 
                     awk '{print substr($2, 0, length($2))}' | \
                     xargs -I % dd if=/dev/urandom of=% bs=1M"

That way when I’m in a tight spot, I don’t have to remember which order to securely erase my drives. This command takes care of it for me.

Just a word of caution: it doesn’t ask first before starting the destruction.

Vote this up on Hacker News.


Have comments? Send a tweet to @TheChangelog on Twitter.

Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.