Shred that file

Ever wanted to be 10000% sure that a file you deleted in Linux was actually deleted? It is said that a file isn’t really deleted from a hard drive in any OS unless you overwrite the exact location it once held in the file system. In Linux, not even the unforgiving rm -rf will permanently delete a file. Yes, it will be removed from the file system where people like you and me cant get them back easily but that will not stop the “geekiest geeks” out there (you know who you are). 😉

In comes the Linux utility “shred“. From the man page:

shred - delete a file securely, first overwriting it to hide its contents

Here is how to use it.

Lets say you have a file called “secret”. The following command makes it so no one can read it. If the file was 12 bytes, it’s now 4096 after it has been over written 100 times. There’s no way to recover or undo this.

$ shred -n 100 -z secret

Want to remove the file as well? Just throw in the “u” option.

$ shred -n 100 -z -u test2

It can even be applied to a device:

$ shred -n 100 -z -u /dev/fd0

Thats it… Hope that eases you paranoid freaks out there. Enjoy!


About this entry