Openwares | open source and free matters» added the recycle bin function for the RM command

Source: Internet
Author: User

Openwares | open source and free matters» added the recycle bin function for the RM command

Add the recycle bin function for the RM command March 11th, 2011 Openwares Leave a comment Go to comments

Rm is a powerful command, especially Rm-RF, which is sometimes powerful enough to make you cry. It's easy to clear all the files and directories in the current directory. 
$ SudoRm-RF./*

It's okay, but if you do not care about it
$ SudoRm-RF/*

Sorry, bro!
There are also a variety of other cups, such as opening a lot of windows, there are local machines and several remote servers, originally want to execute the RM-RF command from this machine, but mistakenly entered to the terminal window of other machines. In short, RM is too dangerous, especially when the-RF parameter is included, be cautious, but when the tiger also has a nap, so why don't you give rm a dose of regret? Well, it's it, trash-cli.

Trash-CLI is a command line deletion tool with the trash function. Its main features include:

    • Compatible with the RM command line interface. Alias RM can be set to trash-cli.
    • Records the original path, deletion time, and object access permission for each deleted file.
    • Compatible with the trash of gnome and KDE desktops to unify desktop and terminal operations
    • Implemented freeyuntop.org trash Specification
    • Supports file systems other than the home file system, such as different partitions or mobile device partitions.

Install trash-cli

The version in the Ubuntu and Debian repositories is too low and has a serious bug. download the latest trash-cli from the official website and run the following command to complete the installation.

1$ TarXvfz trash-cli-0.11.3-R315.tar.gz
2$ CdTrash-cli-0.11.3-R315
3$ SudoPython setup. py install

Configure trash-CLI to replace RM

$ Vim~ /. Bashrc

Add a row
Rm='Trash-put'

When you delete an object using RM, the object will be moved ~ /. Local/share/trash/Files folder, another folder ~ /. Local/share/trash/INFO stores information about the deleted file.

Introduction to trash-CLI Commands

  • Trash-put delete an object
  • $ Trash-Put foo
    The Foo file will be placed in the recycle bin (trashcan)

  • Trash-list: List objects in the recycle bin
  • Restore-trash restore the specified file
  • 1$ Restore-Trash
    2...
    3...
    4What file to restore[0. N]:

    Restore-trash will list all the files in the recycle bin. Each file is preceded by a number starting from 0. Enter the number of the file to be restored as prompted.

  • Trash-empty clear the recycle bin
  • Trash-empty days delete files in the recycle bin that have exceeded the specified number of days
  • 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.