A command line tool written in Rust to interface with the OS's trash-can.
Supported platforms:
- Linux/*BSD: The FreeDesktop.org Trash specification
Warning: rubbish is currently beta level and no guarantees are made about its integrity of managing your files. Additionally, it currently does not properly handle trashing files if the files are on a different filesystem/partition than the home folder.
The following subcommands are provided:
Subcommand | Description |
---|---|
empty |
Empty the trash |
erase |
Erase the specified files (i.e. rm ) |
list |
Recursively list previously trashed files from a specified directory |
prune |
Delete files from the trash that match a specified regex |
put |
Trash the specified files |
restore |
Restore a previously trashed file to its original location |
Prebuilt binaries are provided in the releases tab.
cargo install --git https://github.com/cjbassi/rubbish
Various timers can be setup to automatically empty the trash of files that are older than a specified age. This helps reduce the amount of files in the trash-can and the amount of disk space it uses.
For systemd based Linux distros, a systemd timer file is located here along with the service file here.
To setup the systemd timer:
- Copy both files to
~/.config/systemd/user/
- Customize how often the timer runs (defaults to daily) and how old the files need to be to be deleted (defaults to 30 days)
- Run
systemctl --user daemon-reload
- Run
systemctl --user enable --now trash-empty.timer
- sindresorhus
- rust
- rubbish.py
- trash-cli