Permanently delete files from CentOS

Source: Internet
Author: User
We know that rm is generally used to delete files in Linux, but the rm command does not actually clear the contents of the data block that saves the file, instead, it only releases the index nodes and data blocks occupied by the file. Therefore, the files deleted with rm can be restored through some methods (such as debugfs and Google ). In some cases, we need to completely delete some files, which can be implemented using the shred command. shred is part of coreutils, so this command is basically used in Linux. Shred thoroughly

We know that rm is generally used to delete files in Linux, but the rm command does not actually clear the contents of the data block that saves the file, instead, it only releases the index nodes and data blocks occupied by the file. Therefore, the files deleted with rm can be restored through some methods (such as debugfs and Google ).

In some cases, we need to completely delete some files, which can be implemented using the shred command. shred is part of coreutils, so this command is basically used in Linux.

Shred:

$ Shred-u file

Shred will overwrite the node and data block where the file is located with some random content, and delete the file (-u parameter ).

If you want to clear it more thoroughly, you can add the-z parameter, which means to fill it with random data, and then fill it with 0.

$ Shred-u-z file

In addition, shred can also clear the entire partition or disk. for example, to completely clear the content of the/dev/sdb1 partition, you can do this:

$ Shred/dev/sdb1 (do not add the-u parameter)

Detailed shred parameters:
-F, -- force: change the permission to allow write (if necessary)

-N, -- iterations = N rewrite N times. The default value is 3 times.

-- Random-source = FILE: reads data from a specified FILE

-S, -- size = N to smash the file to a fixed size (suffixes such as K, M, and C can be used)

-U, -- remove rewrite and truncate and remove the file

-V, -- verbose shows the progress

-Z, -- zero-add overwrite data with 0

? Help show help

? Version: displays version information.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.