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 follow the FreeDesktop.org's Trash specification.
Note: Some applications can use a trash can per filesystem (see the specification)
Warning: When deleting files on another filesystem, usage of a trash can induce some latency because the files will be transferred between filesystems. In this case, you might want to use a implementation that create a trash folder per filesystem (See
Trash directories
in the specification).Trash creation
- glib2 provides a
gio trash file...
command to move files into the trash, whilegio trash --empty
empties the trash. See also "trash" in gio(1) § COMMANDS. The gvfs package is required to fully support trash management through thegio trash
command. - kde-cli-tools provides a command that can be used as
kioclient5 move file trash:/
to move to the trash. - trash-cli — A command-line interface implementing FreeDesktop.org's Trash specification.
Trash space usage management
To prevent the trash can from using too much space, you can empty it yourself, or have a pruning policy
Software list
Criteria
- 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
Automation
To automate emptying the trash can, you can use cron, systemd/Timers, or inotify (using inotify, only new deletion would trigger the trash can automation)
Troubleshooting
External drives
might not be set correctly. Note that ID
must be replaced by your own user id by .
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.
gollark: If you become a HyperUltraMegaSuperOmegaPlatinum™ donor (£1e8) we can buy a datacentre for osmarks.net.
gollark: This is amazing software.
gollark: Denied.
gollark: And if you become a PlatinumPlusUltraExtreme™-tier donor for £150000, we can buy one of those 8-GPU A100 servers and [REDACTED] total bee conversion.
gollark: If you donate just £500 we can buy a Dell R720 and cause everyone nearby to suffer from the horrible fan noise.
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.