Moves files into the same trashcan KDE, GNOME, and XFCE use, with restore and listing from the shell. Offers trash-put, trash-list, trash-restore, trash-empty, and trash-rm commands.
Overview
trash-cli exposes the FreeDesktop trash mechanism to shell users and scripts. When you delete with trash-put, files land in the desktop trash with original path, deletion time, and permissions recorded, instead of being removed immediately like rm.
Companion commands list trashed items with timestamps, interactively restore chosen files—including ranges and overwrite options—empty all or aged entries, and remove individual trashed files by pattern. The tools align with the ~/.local/share/Trash hierarchy used on a typical home partition.
Documentation discourages aliasing rm to trash-put because semantics differ, notably around directories and flags. Installation is available through pip, pipx, distribution packages on Debian, Ubuntu, Arch, and Fedora, and Homebrew on macOS, with optional shell completion packages.
The project notes it does not support Btrfs-specific trash handling and points users needing that behavior elsewhere. Cron examples show scheduling trash-empty to purge items older than a set number of days.
Key features
- trash-put with metadata preservation
- Interactive trash-restore selection
- trash-list with timestamps and paths
- Age-based trash-empty cleanup
- Pattern-based trash-rm removal
- Shared freedesktop trash location
- pip, pipx, and distro packages
- Optional bash, zsh, and tcsh completions
Use cases
- Delete safely from terminal scripts
- Recover accidentally removed project files
- Purge old trash on a schedule
- Script trash operations in automation
- Use one trash with GUI and CLI workflows