Wednesday, March 31, 2021

Shred Command- Linux - Better than rm (remove command)

https://www.computerhope.com/unix/shred.htm


In Windows, When We delete a file, It goes to "Recycle Bin" and from there we can again recover it using "restore", So its not irrevocably deleted.

So, We want to permanently delete it, we usually can use "Shift + Delete"


Similarly, Analogy is when we use shredder in real life to shred paper and then throw shredded pieces in trash instead of throwing crumpled paper directly in trash bin.


For Example  -   "shred -u foo.txt"

Description

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

shred [OPTIONS] FILE [...]

Options

-f--forceChange permissions to allow writing if necessary.
-n--iterations=NOverwrite N times instead of the default (3).
-s--size=NShred this many bytes (suffixes like KMG accepted).
-u--removeTruncate and remove file after overwriting.
-v--verboseShow verbose information about shredding progress.
-x--exactDo not round file sizes up to the next full block; this is the default for non-regular files such as device names.
-z--zeroAdd a final overwrite with zeros to hide shredding.
-Shred standard output.
--helpDisplay this help and exit.
--versionOutput version information and exit.

No comments:

Post a Comment

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass