Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to use Trash-CLI with Ranger

📅 2014-Sep-22 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ ranger, trash-cli, trash-put ⬩ 📚 Archive

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