One may ask this question: Why we want to delete files completely from a hard drive? The simplest answer is that, sometimes, we need to destroy some files to prevent other malicious users from recovering them using file recovery software. Or, for example, you can think of selling your computer along with your hard drive and you don't want your confidential information to fall into the hands of others.

In this guide, we are going to see how to delete files and directories in a secure way under Ubuntu so as no one could recover them. To be able to delete files completely from a hard drive, we will use Secure-Delete tools, which are a set of tools used to delete files permanently, you can install it via the Terminal with this command:

sudo apt-get install secure-delete

 Secure-Delete comprises the following four tools:

  • srm: It is used to delete files/directories from your hard disk
  • sdmem: It is used to clean up information stored in your computer memory (RAM)
  • sfill: Secure free disk and inode space wiper
  • sswap: Secure swap wiper
Note: The "srm" tool can be considered an advanced version of the "Shred" command.

Among these tools, we are going to show you only how to use the "srm" tool, the other tools will be explained in next tutorials. To secure delete a file using the "srm" tool, use this command from the Terminal:

srm file.txt

Replace file.txt with your file name and extension.

To delete a directory with the "srm" tool, use this command:

srm -r / directory-name

Replace directory-name with your directory name. The "-r" parameter is used to delete main directories recursively.

Post a Comment