ゴミの管理

提供: ArchWiki
2023年1月16日 (月) 22:56時点におけるKgx (トーク | 投稿記録)による版 (英語版から転載)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
ナビゲーションに移動 検索に移動

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.

ノート: Some applications can use a trash can per filesystem (see the specification)
警告: 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

この記事またはセクションは加筆を必要としています。
理由: Add other utilities (議論: トーク:ゴミの管理#)
  • glib2 provides a gio trash file... command to move files into the trash, while gio trash --empty empties the trash. See also "trash" in gio(1) § COMMANDS. The gvfs package is required to fully support trash management through the gio trash command.
  • kde-cli-tools provides a kioclient5 command that can be used as kioclient5 move file trash:/ to move file to the trash.
  • bashtrash — Freedesktop-compliant trashcan implemented in Bash.
https://github.com/robrwo/bashtrash/blob/master/trash || bashtrashAUR
  • shellDel — Freedesktop-compliant trashcan implemented in Shell script.
https://github.com/Jorengarenar/shellDel || shelldelAUR
https://github.com/andreafrancia/trash-cli || trash-cli
  • 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
  • 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

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

  • autotrash — Tool to automatically purge old trashed files
https://github.com/bneijt/autotrash || autotrashAUR

Criteria

この記事またはセクションは加筆を必要としています。
理由: Add table with a list of 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

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.