Remove the shadow of an important file by mistake using the TRASH-CLI escape RM command

Source: Internet
Author: User

Today is an unforgettable day, at that time originally wanted to clear our company website CMS directory below some CDN push webpage residue of trash file, result in execution Rm-rf conten* when hit RM-RF Conten * result is tragic. CMS directory under the all to delete, the style of the home page is all gone, then silly, the site directly hanging upgrade page, because the backup is not complete, only the test environment pull a copy, and PHP colleagues slowly change, although the best, but to the company caused the impact is very serious, I really want to cry without tears.

Although finally solved, but left me a big shadow, on the internet to find out if it is like Windows. Deleted can go to the Recycle Bin inside to look for, the result Linux really has such tool, that is to use TRASH-CLI.

TRASH-CLI is a software package developed using Python, including,,,,, and trash-put restore-trash trash-list trash-empty trash-rm so on, we can use this command to move files to the Recycle Bin, or to restore deleted files.

TRASH-CLI's project address: HTTPS://GITHUB.COM/ANDREAFRANCIA/TRASH-CLI

I. Installation

The installation of the TRASH-CLI is simple

: Https://github.com/andreafrancia/trash-clicd/tmpunzip trash-cli-master.zipcd Trash-cli-masterpython setup.py Install or: Yum install-y trash-cli installed, I was then Yum installation did not succeed, all can only download the source package installed.

After the installation is successful, our system has the following tools.

[[email protected] tmp]# Ll/usr/bin/|grep trash-rwxr-xr-x  1 root root        123 March   3 15:15 trash-rwxr-xr-x  1 R Oot root        125 March   3 15:15 trash-empty-rwxr-xr-x  1 root root        124 March   3 15:15 trash-list-rwxr-xr-x  1 Root root        123 March   3 15:15 trash-put-rwxr-xr-x  1 root root        127 March   3 15:15 Trash-restore-rwxr-xr-x  1 root root        122 March   3 15:15 trash-rm

Function description

Command Overview: Trash-put          Move a file or directory into the Recycle Bin Trash-empty        Empty the Recycle Bin trash-list         list the files in the Recycle Bin Restore-trash      Restore a file in the Recycle Bin Trash-rm           Delete a single file from the back of the station

After installation we can use some configuration to replace the rm command

We added alias rm= "Trush-put" in the middle of the ~/.BASHRC file and entered SOURCE/ETC/BASHRC is the modified alias in effect.

.

.

Reference Document: Https://blog.phpgao.com/linux-trash-cli.html

Remove the shadow of an important file by mistake by using the TRASH-CLI escape RM command

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.