shred: A power for good or evil

Adding to my list of referenced but undescribed software … I mentioned shred back in March, but didn’t walk through it.


shred is one of the coreutils, and is a mixed blessing, from my standpoint.

On the one hand it does a good job not just erasing, but nullifying any file you feed it. As you can see above.

And you have the option of multiple passes, overwriting zeroes, and a few other weapons of data destruction.

So in that sense, it is a very good solution for permanent data erasure.

On the other hand, as the help flag and the man page suggest, there exist filesystems that may make shred somewhat pointless.

As I understand it, filesystems that employ journaling or some manner of redundancy may still contain data from the shredded file, somewhere in their structures.

And that’s most modern filesystems, probably.

It’s something you should research personally before you rely on shred … or another file-kill utility, for that matter.

For the example in the screenshot, I wrote out a 200Mb+ file with

< /dev/urandom tr -dc A-Za-z0-9 | head -c20480000 testfile.txt

on an ext2 filesystem. As you can see, not only did shred overwrite the file, but also filled it with null characters, making the final head command rather pointless.

Enjoy your newfound superpowers. 😈

2 thoughts on “shred: A power for good or evil

  1. Pingback: trash-cli: Would you like a safety net with that? | Inconsolation

Comments are closed.