Linux under RM Command modification, add Recycle Bin function "notes"

Source: Internet
Author: User

A script that is under the user root directory of Linux. BASHRC finally add the following code, you can modify the RM command, so that people will not be all the RM time to delete, but will be added to the Recycle Bin, the following is based on other people's data reference modified, not original

After joining, you need source. BASHRC

Working principle, redefining RM, each time RM is executed, the file will be MV to the ~/.trash directory

Operation method, under Terminal execution:

Mcls-----"empty. Trash files in the Recycle Bin

ur restores the specified file

Cattrash viewing the contents of the Recycle Bin

Mkdir-p ~/. Trash alias RM=Trash #alias R=Trash alias Cattrash='ls ~/.trash'alias ur=Undelfile alias Mcls=Cleartrash Undelfile () {MV-I ~/.trash/[email protected].} trash () {MV [email protected]~/.trash/} cleartrash () {Read-P"Clear sure? [N]"Confirm [$confirm=='y'] || [$confirm = ='Y'] &&/BIN/RM-RF ~/.trash/* }

Linux under RM Command modification, add Recycle Bin function "notes"

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.