← 返回命令列表

Linux command

gtrash 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Move files to trash

gtrash put [path/to/file1] [path/to/file2]

List files in the trash

gtrash find

Restore files interactively

gtrash restore

Permanently delete files

gtrash find --rm "[pattern]"

Show trash summary

gtrash summary

Clean up old files

gtrash prune --day [30]

说明

gtrash is a featureful trash CLI manager that serves as a safer alternative to rm. Instead of permanently deleting files with the unlink syscall, it moves them to the system trash using the rename syscall, enabling easy restoration. It follows the FreeDesktop.org Trash specification, making it compatible with desktop trash implementations and other tools like gio trash and trash-cli. Key features include directory size caching for fast browsing, restoration of co-deleted files, an interactive TUI for selecting files to restore, and support for external drives with per-volume trash directories.

参数

put
Move files to trash
find
List files in trash (supports --rm to permanently delete matches)
restore
Interactively restore files from trash using TUI
summary
Show trash size summary
prune
Remove old files from trash
--day _N_
Used with prune to specify age threshold in days
--rm
Used with find to permanently delete matching files

FAQ

What is the gtrash command used for?

gtrash is a featureful trash CLI manager that serves as a safer alternative to rm. Instead of permanently deleting files with the unlink syscall, it moves them to the system trash using the rename syscall, enabling easy restoration. It follows the FreeDesktop.org Trash specification, making it compatible with desktop trash implementations and other tools like gio trash and trash-cli. Key features include directory size caching for fast browsing, restoration of co-deleted files, an interactive TUI for selecting files to restore, and support for external drives with per-volume trash directories.

How do I run a basic gtrash example?

Run `gtrash put [path/to/file1] [path/to/file2]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does put do in gtrash?

Move files to trash