Shredding a file in Linux with shred

Intro

        When deleting a file by simply pressing the delete button there is the possibility that the file can be recovered. That's where shred comes in, What shred does is to wipe the file and make it unrecoverable. This can be very useful if you want to delete a file with sensitive data.

Disclaimer

          This tutorial is ONLY for educational reasons. Do not misuse this information. I am not responsible for the way you use this knowledge. And remember with great power comes great responsibility.

How to use

syntax : 
shred [options] [file]
Basic options :
        -f    force permissions
        -u   remove after
        -v   verbose
        -z   write zeros at the end
        -n [number]   times of shredding
For more options see the man page :
man shred

Tutorial

      For this tutorial i have created a textfile named secret.txt as you can see bellow





















To shred the file enter the following command:
sudo shred -f -u -v -z -n 34 secret.txt




















And execute the command. Depending on the files size it can take a lot of time, but in this case the small textfile was almost instantly shredded.
And you can see in the image bellow that the file has been safely deleted.

Download

Shred is part of the coreutils package so you will have to download that if it doesn't exist
Linux : sudo apt-get install coreutils
Arch Linux : sudo pacman -S coreutils

Epilogue

If you have any questions or suggestions or if you noticed any mistakes or something i forgot don't hesitate to comment it bellow.

No comments:

Post a Comment