LinuxCommandLibrary

gvfs-trash

Move files to the trash/recycle bin

SYNOPSIS

gvfs-trash [OPTION...] FILE...
gvfs-trash trash://...

PARAMETERS

-e, --empty
    Empty all trashcans managed by GVFS

-h, --help
    Show help information

-?, --help-all
    Show all help options

-V, --version
    Print version and exit

DESCRIPTION

The gvfs-trash command is a utility from the GNOME Virtual File System (GVFS) package that moves files or directories to the trash can, mimicking the graphical 'Delete to Trash' action in GNOME environments.

It supports local paths and GVFS URIs (e.g., file://, trash://), allowing interaction with virtual filesystems like remote mounts or FUSE. Unlike rm, which permanently deletes, gvfs-trash preserves files in a recoverable trash location per volume or user home.

Requires a running GVFS daemon (gvfsd-trash). Ideal for scripts automating safe deletions in desktop sessions. Files are moved to ~/.local/share/Trash for home or /.Trash-$UID on other volumes.

Empty trash with --empty. Undelete via file manager or gvfs-restore. Supports recursion for directories.

CAVEATS

Requires GVFS daemon; may fail on non-GVFS filesystems or without write access to trash dirs. No force flag—use rm for permanent delete. URIs needed for virtual FS.

URI SUPPORT

Accepts GVFS URIs like file:///path/to/file or trash:/// for listing trash contents.

EXAMPLES

gvfs-trash file.txt
gvfs-trash --empty
gvfs-trash smb://server/share/doc.pdf

HISTORY

Introduced in GVFS 0.1 (2008) for GNOME 2.28; evolved with GIO integration. Superseded by gio trash in gvfs 1.20+ (2013), but gvfs-trash remains for compatibility.

SEE ALSO

gio(1), rm(1), trash(1)

Copied to clipboard