trash-cli: Trash from the cmdline

trash_compDid you ever want to access your trash from the cmdline? There are instances where I needed it. trash-cli makes the process easier by providing a simple cmdline interface to the freedesktop.org trash. This also means that it is supported by all desktop environments building on freedesktop.org e.g. KDE, Gnome, LXDE, XFCE etc.

trash-cli records the original path, deletion date and permissions.

Installation

Run the following commands to install trash-cli:

$ git clone https://github.com/andreafrancia/trash-cli.git
$ sudo python setup.py install

In case you want to install it for the current user only:

$ git clone https://github.com/andreafrancia/trash-cli.git
$ python setup.py install --user

Usage

trash-cli supports the following commands:

trash-put  : trashes files and directories
trash-empty          : empty the trashcan(s)
trash-empty    : remove the files deleted before 
trash-list           : list trashed file
trash-restore        : restore a trashed file
trash-rm   : remove individual files from trash

While most commands are self-explanatory, here’s an example of trash-rm which also accepts a pattern:

$ trash-rm \*.o

You need to use quotes in order to protect pattern from shell expansion.

If you want to create a top-level Trash-can from the cmdline, here are the steps:

$ sudo mkdir --parent /.Trash
$ sudo chmod a+rw /.Trash
$ sudo chmod +t /.Trash

On GitHub: trash-cli

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s