How to secure delete files in Linux

Shred

shred OPTIONS filename

Common options: -n N Overwrite a file N times. -u Remove the file after you’ve shredded it. -z After shredding a file with random bits (ones and zeros), overwrite the file with only zeros.

So, for example, to shred a file “topsecret.txt” with 26 iterations, and delete it afterwards, and hide the fact that it was shredded, I would run:

shred -u -z -n 26 topsecret.txt

Secure-Delete

The Secure-Delete tools are a particularly useful set of programs that use advanced techniques to permanently delete files. To install the Secure-Delete tools in Ubuntu, run:

apt-get install secure-delete

The Secure-Delete package comes with four commands: srm Secure remove; used for deleting files or directories currently on your hard disk; smem Secure memory wiper; used to wipe traces of data from your computer’s memory (RAM); sfill Secure free space wiper; used to wipe all traces of data from the free space on your disk; sswap Secure swap wiper; used to wipe all traces of data from your swap partition.

Secure delete from Nautilus

  • Install the Nautilus Actions Configuration utility
sudo apt-get install nautilus-actions
  • Configure the new menu option

Now you should have an option in the Preferences menu called “Nautilus Actions Configuration.” Click the “define new action” button. Give it a name ("Shred").

Next, click the “Command” tab. The command is /usr/bin/shred. The parameters would be:

“-u %M -z -n 7”

Done!

Source 1 Source 2

Page top