How to use Trash-CLI with Ranger

When a file is deleted using Ranger, that deletion is permanent. Instead, if you would like to delete files to Trash, then you can do that using the Trash-CLI set of tools.

Installing them is easy:

$ sudo apt install trash-cli

The tool we are interested in is trash-put which deletes a file to the Trash. The Trash directory is usually ~/.local/share/Trash. Any key can be mapped in Ranger to this command for deletion.

For example, to map the Del key to delete to Trash, add this to your ~/.config/ranger/rc.conf:

map <DELETE> shell -s trash-put %s

Tried with: Ranger 1.6.1, Trash-CLI 0.12.7-1 and Ubuntu 14.04

3 thoughts on “How to use Trash-CLI with Ranger

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.