Securely delete files on Mac OS X in the Terminal by using srm:
srm <filename>
This will delete the file, then rewrite random data over the spot on the hard disk where the file was previous stored several times to prevent any file recovery attempts.
A regular delete using rm in the Terminal will only remove any pointers to the file itself, but this information can be recovered using file recovery and undelete tools. This is similar to erasing an entry in the telephone book for someone’s house and phone number; the house is still standing and telephone number is still valid. Using srm would send a bulldozer to the house to tear it down and break it into bits so small, it would be difficult to tell that a house ever stood there.
Securely deleting files is useful when you need to destroy a password file. For example, I keep a file that is pgp encrypted with all my passwords within it. When I need to add new passwords, I decrypt the file, add the new username/passwords, then re-encrypt the file. Afterwards, I need to securely destroy the text file that I updated. For that, I use srm.
Read more about srm at Wikipedia.
Leave a Reply