Linux system RM Delete command "dangerous"!!!

Source: Internet
Author: User

Linux System RM Delete command (dangerous)

Brief Description: in the Linux system operation and Operation of the rm Delete command, very dangerous, because the permissions are too large, a careless will be the entire server of the data instantly deleted, so how to skillfully use the RM command to delete files, and eliminate the accidental deletion of the situation happened?

Method One:

Description: We can find a command through find, will need to delete the file found after the correct deletion.

Command-Line Operations:

[[email protected] oldboy]# Find/-type f-name "Oldboy"-execrm-f {} \;

#find-type F Find file type,-name "Oldboy" Find file name-exec rm-f {} \; Delete changed file {} represents what has been found \; Escape

[[email protected] oldboy]# Find/-type f-name "Oldboy" |xargsrm-f

#find –type F find the file type, pipe |xargs means you can use the command to find the content on the line operation, rm-f delete the found content

Tips:

The above instructions, you need to ensure that the found content is what you want to delete and then delete.


Method Two:

Note: We can also move files that need to be deleted to other directories and then delete them by using the MV Move command, which is similar to how Windows moves deleted files to the Recycle Bin.

Command-Line Operations:

[email protected] oldboy]# mv oldboy/tmp/ # MV Mobile Oldboy to/tmp

[email protected] oldboy]# rm-f/tmp/oldboy # RM Delete-F Force Oldboy file









This article is from the "Breeze Cool" blog, please be sure to keep this source http://jiay1.blog.51cto.com/9144615/1708381

Linux system RM Delete command "dangerous"!!!

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.