Skip to content

shred

When you delete a file from Linux or from any Operating System, then the file is not deleted permanently from the hard disk. When a file is deleted, it first gets moved to the trash and as soon as you clear off the trash the files get deleted for the file system


Overwrite the contents of the file multiple times to make it unrecoverable.

shred filename.txt

To change the number of times a file is to be overwritten

  • By default, Shred performs 3 iterations but with this option we can define the number of iterations
shred -n 10 filename.txt

To remove the file after the shredding process is complete

shred -u filename.txt

To overwrite some specific bytes of text only

shred -s 5 filename.txt

To run shred command with verbose mode or to get how many times the file is overwritten

shred -v filename.txt´

To change permissions to allow writing if necessary while using shred command

shred -f filename.txt

To add a final, overwrite with zeros to hide shredding

shred -z filename.txt`