How to shred a file on Linux leaving no remnants

Sometimes we have files on our hard disks that we would like to remove for good. If you have set up full disk encryption when you installed Linux on your computer, you will have an encrypted hard disk which is pretty much useless to anyone without the password that only you know.

However, sometimes, to add another layer of security, we would like to delete files without leaving any of it’s contents on the hard disk, even if full disk encryption is enabled. To do this, Linux offers the ‘shred’ command.

To shred a file, open a terminal window and enter the following command:

$ shred -n8 -u -v -z file.txt <enter>

where file.txt is the file that is to be shredded.

-n8 means that we want the 8 iterations of shredding in place of the default that is 3.

-u means means truncate and remove the file after shredding is done.

-v is for verbose. Display what is happening on screen.

-z is to add final zeros to the file space once shredding is complete.