To delete files and folders in linux, you can directly use rm to delete them. to delete files or folders completely, you can use the shred command. next I will introduce them to you.
Deleting a directory in linux is very simple. many people are still used to using rmdir. However, once the directory is not empty, it is deeply worried. now we can use the rm-rf command.You can simply use rm, but you need to add two parameters-rf: rm-rf directory nameDele
Using the rm DELETE command in linux to delete a file only recycles the inode of the file. This does not mean that the block is completely cleared, for details, refer to my previous blog post "Understanding the linux File System in depth ".
To delete the rm command, we can use tools like ext3grep and photorec before the partition of the deleted file is overwritten into new data. What if we want to completely delete a file?
The shred command is als
delete the attributes, which is the same as that of chmod.
$ Chattr-a test1
In this way, the limit that test1 can only append data is removed and can be freely modified.
There are many parameters available for chattr. In addition to the two parameters described above
I attribute: This file cannot be modified, deleted, or renamed.
C attribute: when saving the file, compress the file.
There are many other parameters. You can refer to the chattr help. Then let's talk about
. This command provides safe memory cleanup and simply runs the smem command on the terminal.
smem
Shred
The "shred" command destroys the content of a file or folder in an unrecoverable manner. It uses a randomly generated data mode to continuously overwrite files, making it difficult to recover arbitrary destroyed data, even when hackers or thieves use high-level data recovery tools or devices.
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.
Deleting a file or reformatting the disk does not destroy sensitive data, and it can be recovered even if the data is deleted. Removing some useless data is a good thing, but if you delete financial data, a bank account password, or a classified company information that cannot be completely removed, this article will describe some of the tools that can safely delete files in the Linux Ubuntu operating system.
Shred
Although the
: fixed notation RM-RF: Forcibly deleting files, including directories {} ; : fixed notation, pair of curly braces + space +/+;Delete Files completelySometimes we have to completely delete some files, you can use the Shred command to implement,shred is a part of the coreutils , so Linux basically will have this command. Shred How to delete files completely :Th
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.
"*" indicates all files.-Exec: fixed syntax
Rm-rf: force delete files, including directories{};: Fixed writing method, a pair of braces + spaces +/+;
Permanently delete an object
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:
: fixed notation RM-RF: Forcibly deleting files, including directories {} ; : fixed notation, pair of curly braces + space +/+;Delete Files completelySometimes we have to completely delete some files, you can use the Shred command to implement,shred is a part of the coreutils , so Linux basically will have this command. Shred How to delete files completely :Th
second scenario, one common task we will do is to find a word in a text file and use another word to replace all the examples of the word in the text.
For example, assume that I mentioned a person named "Becky" in a document, but I decided to use the formal name "Rebecca" later. For this simple change in the file, the following command will play a role:
Perl-pi-e's/Becky/Rebecca/'mydocument.txt
This micro Perl script queries all the "Becky" instances in the document and changes it to "Rebecca "
"*.*": the type of data you want to find, "*.jpg" means to find all files with the extension jpg, "*" to find all files
-exec: Fixed wording
RM-RF: Force delete files, including directories
{} ; : fixed wording, a pair of curly braces + space +/+;
Delete Files completely
Sometimes we have to completely delete some files, you can use the Shred command to achieve, shred is a part of the coreutils, so t
find, "*.jpg" means to find all files with the extension jpg, "*" to find all files-exec: Fixed wordingRM-RF: Force delete files, including directories{} ; : fixed wording, a pair of curly braces + space +/+;
Delete Files completely
Sometimes we have to completely delete some files, you can use the Shred command to achieve, shred is a part of the coreutils, so the basic Linux will have this command.
extension jpg, "*" means finding all files-exec: Fixed notationRM-RF: Forcibly deleting files, including directories{} ; : fixed notation, pair of curly braces + space +/+;Delete Files completelysometimes we have to completely delete some files, you can use the shred command to implement, Shred is a part of the coreutils, so Linux basically will have this command.Shred how to delete files completely:The co
Delete files and folders in Linux we can use RM directly to delete, delete files or folders completely we can use the Shred command to complete, below I give you introduction.
Linux Delete Folder command
Linux Delete directory is very simple, many people are still accustomed to using rmdir, but once the directory is not empty, into deep distress, now use the RM-RF command.
Direct RM is OK, but add two parameters-rf namely: RM-RF directory Name
Del
need to do in the current folder:Rm-rf! (keep) #删除keep文件之外的所有文件Rm-rf! (Keep1 | keep2) #删除keep1和keep2文件之外的所有文件
completely delete files in Linux
Shred the method of deleting a file completely:
$ shred-u File
Shred uses random content to overwrite the nodes and blocks of the file, and deletes the file (-u parameter).
If you want to erase a bit more thoroughly
folder:Rm-rf! (keep) #删除keep文件之外的所有文件Rm-rf! (Keep1 | keep2) #删除keep1和keep2文件之外的所有文件Completely remove files from LinuxShred how to delete files completely:$ shred-u FileShred will overwrite the node and data block where the file resides with some random content, and delete the file (-u parameter).If you want to clear a bit more thoroughly you can add the-z parameter, which means to fill with random data, and then fill it with 0.$
Endurer note: File crushing program. I used to use Turbo C 2.0 to write a command line program running in DOS. The file length seems to be more than 9 KB. Later I used ASM to write the program, the file length is less than 700 bytes, that is,
Shredder is implemented in the GUI window on Windows platform. It is really great to keep a slim figure of 9kb (the length of the EXE file is 40,960 bytes, And the ZIP file is 9,526 bytes after compression, I don't need to do it myself.
License type Free
Linux Command learning Summary: rm command, linux Command summary rm
Command introduction:
This command is used to delete files or directories in Linux. Normally, rm will not delete the directory. You must specify the-r or-R parameter to delete the directory. In addition, rm can usually restore the file or directory. (Note: When rm deletes a file, it only releases the index point pointing to the data block (information nodes), as long as it is not overwritten, the data is still on the hard d
, and he can easily see that someone has come in.
If you do not want to delete a file by using rm, it is not advisable to delete the file by using shred.
Shred-n 31337-z-u file_to_delete
In this way, multiple erasure operations are safe. Haha
The following is a detailed analysis of log files.
The W Command provides the administrator's ability to view the current logon account. Therefore, it is very dangerou
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.