Open In App

Tools to Securely Delete Files from Linux

Every time you delete a file from your Linux system using the shift + delete or rm command, it doesn’t actually permanently and securely delete the file from the hard disk. When you delete a file with the rm command, the file system just frees up the appropriate inode but the contents of the old file are still in that space until it is overwritten which pave a way to recover the files.

The space that was used by the file that you deleted is now free to be used by other new files. But the contents of the old files are still in the hard disk, Until and unless that space is overwritten by something else, so there is a good chance that the file can be recovered by anyone (maybe by some data thieves) with good knowledge of recovering data. It is like removing the index page of a book, where the chapters are still there, it just becomes much hard to find, but we can find it.
 



Tools to Securely Delete Files from Linux

Method 1: Using Shred

Shred will help you to overwrite a deleted file, so it becomes difficult to recover it. It is like tearing a paper into as many pieces as you want or overwriting over the paper so that it becomes impossible to find out the original data.

manual of shred

shred



In the above output, the meaning of the letters are:

Method 2: Secure-Delete:

Secure-delete is a command containing a set of secure file deletion tools containing srm (secure_deletion) tool which is used to delete or overwrite the files securely in Linux.
 
At first, we have to install it by typing:

sudo apt-get install secure-delete 

install secure-delete

There is a total of 4 different types of tools consisting of this whole package and each of them performs a different type of securely delete operation. They are as follows:-

# srm Command:
srm command deletes anything just like rm command but securely i.e by overwriting the file and its inode with random bytes. The larger the file, the longer it takes to wipe and rewrite it.

srm tool

Type srm man to get more information:

 manual

Method 3: Using Wipe.

The Linux wipe command allows us to securely erase data from our hard disk permanently. The wipe command erases files from magnetic memory and rewrites the space repeatedly and wipe away the caches which make the data nearly impossible to be recovered. 

At first, we have to install a wipe:

sudo apt-get install wipe

Now you can use wipe for secure deletion 

wipe

To know more about each function check wipe -h:

manual of wipe command

Method 4: Using dd:

dd command is especially used to convert or copy files. We can use this command to completely overwrite your hard drive with zeros, but DD will not zero a drive currently in use

The syntax is :

- dd if=<source> of=<target> [Options]

In the above menu:

See the help menu of the “dd” command for more details:

dd help menu


Article Tags :