Trash management
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 follows the FreeDesktop.org's Trash specification.
Note Some applications can use a trash can per filesystem. If that’s not the case, deleting files on another filesystem than your
$HOME can induce some latency because the files will be transferred between filesystems.Tools
Most GUI file managers, such as GNOME Files and Dolphin, natively support moving files into the trash and managing its content.
Electron Applications need trash-cli to use the trash.
Command line
-
glib2 provides a
gio trashcommand, seetrashin gio(1) § COMMANDS. The gvfs package is required to fully support trash management, e.g.gio trash --list. -
kde-cli-tools provides a
kioclient5command that can be used askioclient5 move file trash:/to movefileto the trash. - trash-cli — Command line trashcan (recycle bin) interface, used
- trash-d — drop-in replacement for GNU rm, focusing on compatibility and with much better performance, written in D.
- trashy — simple, fast, and featureful alternative to rm and trash-cli written in rust
- gtrash — A featureful trash CLI manager written in Go
- python-send2trash — Send file to trash natively
- trashman — A Python trash manager
- rmtrash — trash-put made compatible to GNUs rm and rmdir
- rmw (ReMove to Waste) — A trashcan/recycle bin utility for the command line.
Automatic cleaning
- autotrash — Tool to automatically purge old trashed files
- Dolphin can automatically remove files older than a give number of days, and warn you or remove older or bigger files if the trash can goes above a size threshold. See official documentation.
- GNOME can automatically remove older files, see official documentation.
- rmw (ReMove to Waste) — A trashcan/recycle bin utility for the command line, that can automatically remove files older than a given number of days, see CONFIGURATION in the manual
Troubleshooting
Unable to find or create trash directory
External drives
/etc/fstab might not be set correctly. Note that ID must be replaced by your own user id by $ id.
/etc/fstab
# <device> <dir> <type> <options> <dump> <fsck> UUID=75667752-8b06-11ea-bc55-0242ac130003 /externalDrive ntfs-3g defaults,uid=ID 0 1
Make sure that the root directory of the drive contains ~/.Trash-1000/{expunged,files,info} and set relevant read permissions for the directory and sub-directory.