Did 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.
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
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