CentOS系统回收站文件保留时间说明
CentOS系统本身未内置传统意义上的“回收站”功能,但可通过trash-cli工具(命令行)或桌面环境(如GNOME)的gvfs-trash工具实现类似功能,其保留时间可通过配置调整。
/etc/trash.conf(适用于所有用户),找到trash_keep_days参数(部分版本为days),取消注释并设置为所需天数(如trash_keep_days = 15表示保留15天);~/.trashrc(仅当前用户生效),添加DELETE_DELAY=10(保留10天)等参数;systemctl restart trash-cli)或等待下次删除操作生效。~/.config/user-dirs.dirs或dconf数据库管理,无统一默认值。dconf-editor工具修改(图形界面):打开dconf-editor→导航至org→gnome→desktop→interface,查找回收站相关设置(如trash-empty-time)并调整;dconf-editor):gsettings set org.gnome.desktop.interface trash-empty-time 10(保留10天)。tmpwatch或tmpreaper命令定期清理/tmp或自定义回收站目录(如~/.trash),默认保留时间可能为30天(需手动配置脚本执行周期,如/usr/sbin/tmpwatch 30d /home/username/.trash)。~/.local/share/Trash/目录(桌面环境),其保留时间由上述工具配置决定;trash-cli),否则设置可能不生效。