← 返回命令列表

Linux command

gvfs-trash 命令

文件

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

常用示例

Move a file to the trash

gvfs-trash [path/to/file]

Move multiple files to the trash

gvfs-trash [file1] [file2] [file3]

Empty the trash

gvfs-trash --empty

Move files to trash

gvfs-trash -f [path/to/file]

Read files to trash from stdin

echo "[path/to/file]" | gvfs-trash

说明

gvfs-trash is a GNOME Virtual File System command that moves files and directories to the user's trash bin instead of permanently deleting them. This provides a safer alternative to rm by allowing recovery of accidentally deleted files. The trash location depends on the file's filesystem. For files in the user's home directory, trash is stored in $XDG_DATA_HOME/Trash (typically ~/.local/share/Trash). Files on removable drives may have their own trash folders. When called without the --empty option, gvfs-trash expects file paths as arguments. If no files are specified, it reads paths from standard input, one per line. Moving files to trash does not free disk space until the trash is emptied.

参数

-f, --force
Ignore nonexistent and non-deletable files
--empty
Empty the trash
-h, --help
Print help text and exit
--version
Show version information and exit

FAQ

What is the gvfs-trash command used for?

gvfs-trash is a GNOME Virtual File System command that moves files and directories to the user's trash bin instead of permanently deleting them. This provides a safer alternative to rm by allowing recovery of accidentally deleted files. The trash location depends on the file's filesystem. For files in the user's home directory, trash is stored in $XDG_DATA_HOME/Trash (typically ~/.local/share/Trash). Files on removable drives may have their own trash folders. When called without the --empty option, gvfs-trash expects file paths as arguments. If no files are specified, it reads paths from standard input, one per line. Moving files to trash does not free disk space until the trash is emptied.

How do I run a basic gvfs-trash example?

Run `gvfs-trash [path/to/file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -f, --force do in gvfs-trash?

Ignore nonexistent and non-deletable files