Linux Shred Command

Shred is a program that will overwrite your files in a way that makes them very difficult to recover by a third party.


Normally, when you delete a file, that portion of the disk is marked as being ready for another file to be written to it, but the data is still there. If a third party were to gain physical access to your disk, they could, using advanced techniques, access the data you thought you had deleted.


The analogy is that of a paper shredder. If you crumple up a piece of paper and throw it in the trash can, a third party could come along, root through your trash, and find your discarded documents. If you want to destroy the document, it's best to use a paper shredder. Or burn it, I suppose, but that's not always practical in a typical office.


The way that shred accomplishes this type of destruction digitally is to overwrite (over and over, repeatedly, as many times as you specify) the data you want to destroy, replacing it with other (usually random) data. Doing this magnetically destroys the data on the disk and makes it highly improbable that it can ever be recovered.


Syntax:


Options:


-f, --force >> Change permissions to allow writing if necessary.

-n, --iterations=N >> Overwrite N times instead of the default (3).

-s, --size=N >> Shred this many bytes (suffixes like K, M, G accepted).

-u, --remove >> Truncate and remove file after overwriting.

-v, --verbose >> Show verbose information about shredding progress.

-x, --exact >> Do not round file sizes up to the next full block; this is the default for non-regular files such as device names.

-z, --zero >> Add a final overwrite with zeros to hide shredding.

- >> Shred standard output.

--help >> Display this help and exit.

--version >> Output version information and exit.


After destroying the FILE data, shred also deletes the FILE(s) if --remove (-u) is specified. The default is not to remove the files because it is common to operate on entire device files like /dev/hda, and those files usually should not be removed. When operating on regular files, most people use the --remove option.




Trick!


You can create an alias to make it easier to remove your files:


22 views0 comments