To prevent accidental deletion of files, you can use a trash can. To ensure compatibility between multiple applications, you can use software (CLI, GUI or Library) that follow the FreeDesktop.org's Trash specification.
Trash directoriesin the specification).
gio trash [FILE1] [FILE2] ...command that allows to move files into the trash, while
gio trash --emptyempties the trash
- trash-cli — A command-line interface implementing FreeDesktop.org's Trash specification.
- bashtrash — Freedesktop-complient trashcan implemented in bash script
- trashman — A Python trash manager
- rmtrash — trash-put made compatible to GNUs rm and rmdir
Trash space usage management
To prevent the trash can from using to much space, you can empty it yourself, or have a pruning policy
autotrash (not in the AUR)
- make sure to have at least x MB of free space
- delete files older than x days
- only empty if you have less than x MB of free space (useful in combination of previous criteria)
- maximum trash can size
- file size
- file type
- original path