Home / How-to Guides / How to Shred files completely from Hard Drive using Ubuntu

How to Shred files completely from Hard Drive using Ubuntu

Victor asked in regard to our previous article, "How can I wipe or erase some files completely and not wipe hard drive, since I will be sharing my system with others for temporarily period and want to move & delete those file before sharing.”  A very nice question by Victor, we replied back with the solution which we was looking for. In case at some point in time you have similar problem or query where you want to delete some important files completely from the system then below is what you can do.

Do you store your password, bank information or financial data on a file onto your computer/laptop and would be sharing the system with other or may be selling the system? If yes, then you might be at a huge risk of data and financial loss. Because you might usually delete those files from system and then share your system with others or may sell it but the file which was deleted is not completely deleted. It is still present on your hard drive and can be easily recovered using data recovery software. In our previous post, we covered how data/files are present in the hard drive even though you have deleted it from the system. If there are some files you want to remove from the system and hard drive completely, then the easiest method to do this is “shred” – a built-in Linux utility.

Shred Files using Ubuntu

1. Open Terminal and Navigate to the directory where the file is saved that you want to delete. Type cd to change directory and ls to list the files and folders in current directory.

Navigate to the directory using CD and LS command

2. Type the below command along with the file name which you want to shred.

shred <filename>

You will notice that the file is not been deleted yet, but if you open the file, the content will be unavailable. It is evident that the file has been overwritten securely. However, we also want the shredded file to be deleted from the hard drive as well.

File has been overwritten using shred

3. Type the below command to shred and delete files from the hard drive.

shred --remove <filename>

shred and delete files

By default, shred overwrites the files 25 times. We can also increase the overwrite iteration by providing the below command.

shred –remove --iterations=50 <filename>

shred with double the iteration and delete files

Your file is now securely wiped and deleted from the hard drive. Follow the same steps for other files on your hard drive.

About Kroshan

Roshan Karkera a.k.a. k.roshan. Blogger by passion and software engineer by profession. He believes in sharing knowledge, which made him to start his own blog. He is very much keen & passionate about new technology & Science. If you'd like to connect with him, follow at Google plus or Twitter.