Deleting a file or reformatting the disk does not destroy sensitive data, and it can be recovered even if the data is deleted. Removing some useless data is a good thing, but if you delete financial data, a bank account password, or a classified company information that cannot be completely removed, this article will describe some of the tools that can safely delete files in the Linux Ubuntu operating system.
Shred
Although the shred command has some limitations, the shred command can effectively and completely delete files, making them difficult or unrecoverable. The shred is done with a complete deletion: rewriting the file to the maximum extent possible by using the data schema, making it difficult to recover data even with a highly sensitive data recovery device.
Deleting a file by using the RM command does not actually destroy the data, it simply destroys the index where the file is located, and makes the file's block of data available for reuse. Therefore, files deleted using the RM command can easily be recovered using special devices or commands, provided that the database released by the file has not been reused. However, in a dynamic system that is completely hard drive (HDD), the freed space can only be recovered within minutes or seconds.
Shred statement
shred[option(s)]file(s)_or_devices(s)
Available options
-f,–force– Change permissions allow write (if necessary)
-n,–iterations=n– rewrite n times instead of default (25) times
-s,–size=n– the file to a lot of bytes (you can use suffixes such as K, M, C, etc.)
Truncate and remove files after-u,–remove– rewrite
-v,–verbose– Display Process
-x,–exact-do not round file sizes up to the next full block
-z,–zero-add a final overwrite with zeros to hide shredding
-shred Standard Output
–help– Show Help and exit
–version– output version information and exit
Shred sample
1 The following commands can be used to safely delete three folders: File1, File2 and File3:
shredfile1file2file3
2 The following command deletes the data on the seventh partition of the first HDD:
shred/dev/hda7
3 You can use the following commands to erase the file system path you created in the floppy disk on the first disk, which takes 20 minutes to erase the floppy disk "1.44MB" (actually 1440KiB):
shred–verbose/dev/fd0