How to Permanently Delete Files in Linux

By Kristen Waters

The rm command is the normal way to delete files on the Linux operating system. The rm command only removes the operating system's link to the file. You can use special tools to recover the file, sometimes even after it has been written over. The shred, srm and wipe commands can be used to delete the file so that it cannot be recovered. These commands write over the file numerous times before completely deleting the file. Each command uses a different method to write over the data. Employ the wipe command on any magnetic media.

Shred

Click on the distribution's main applications menu.

Click on the "Terminal" or "Konsole" menu option to open a terminal window and access the command prompt.

Type the command "shred -u -z -n 20 filename" to write random ones and zeros over the file 20 times, then write zeros over the entire file and finally delete the file. Replace "filename" with the name of the file that you want to delete.

Srm

Click on the distribution's main applications menu.

Click on the "Terminal" or "Konsole" menu option to open a terminal window and access the command prompt.

Download and install the secure-delete package from the distribution's software repository. Ubuntu and Linux Mint users type "sudo apt-get install secure-delete" to install the tools. Fedora and CentOS users type "yum install secure-delete" to install the tools.

Type the command "srm filename" to assign a random value for the file name and overwrite the file with random data, zeros and special values to erase all evidence that the file existed. Replace "filename" with the name of the file to be deleted.

Wipe

Click on the distribution's main applications menu.

Click on the "Terminal" or "Konsole" menu option to open a terminal window and access the command prompt.

Download and install the wipe package from the distribution's software repository. Ubuntu and Linux Mint users type "sudo apt-get install wipe" to install the package. Fedora and CentOS users type "yum install wipe" to install the package.

Type the command "wipe -dkx filename" to completely remove the file from the disk. Replace "filename" with the name of the file to be deleted.

×