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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s