Jump to content

Trash management

From ArchWiki

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

This article or section needs expansion.

Reason: Add other utilities (Discuss in Talk:Trash management)
  • glib2 provides a gio trash command, see trash in gio(1) § COMMANDS. The gvfs package is required to fully support trash management, e.g. gio trash --list.
  • kde-cli-tools provides a kioclient5 command that can be used as kioclient5 move file trash:/ to move file to the trash.
  • trash-cli — Command line trashcan (recycle bin) interface, used
https://github.com/andreafrancia/trash-cli || trash-cli
  • trash-d — drop-in replacement for GNU rm, focusing on compatibility and with much better performance, written in D.
https://github.com/rushsteve1/trash-d || trash-dAUR
  • trashy — simple, fast, and featureful alternative to rm and trash-cli written in rust
https://github.com/oberblastmeister/trashy || trashyAUR trashy-binAUR trashy-gitAUR
  • gtrash — A featureful trash CLI manager written in Go
https://github.com/umlx5h/gtrash || gtrash-binAUR
  • python-send2trash — Send file to trash natively
https://github.com/hsoft/send2trash || python-send2trash
  • trashman — A Python trash manager
https://github.com/Kwpolska/trashman || trashmanAUR
  • rmtrash — trash-put made compatible to GNUs rm and rmdir
https://github.com/PhrozenByte/rmtrash || rmtrashAUR
  • rmw (ReMove to Waste) — A trashcan/recycle bin utility for the command line.
https://theimpossibleastronaut.com/rmw-website/ || rmwAUR

Automatic cleaning

  • autotrash — Tool to automatically purge old trashed files
https://github.com/bneijt/autotrash || autotrashAUR
https://theimpossibleastronaut.com/rmw-website/ || rmwAUR

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.