gvfs-trash
Move files to the trash/recycle bin
SYNOPSIS
gvfs-trash [OPTION...] [FILE...]
PARAMETERS
-h, --help
Show help options and exit.
--version
Show version information and exit.
--empty
Empty the trash bin.
DESCRIPTION
gvfs-trash is a command-line utility provided by the GNOME Virtual File System (GVFS) suite, designed to offer a safe alternative to permanent deletion. Its primary purpose is to move specified files or directories to the user's trash bin, rather than permanently removing them from the file system. This functionality is crucial for preventing accidental data loss, as it allows for easy recovery of items that might have been inadvertently deleted. It mimics the familiar "move to trash" behavior found in graphical desktop environments, providing a consistent user experience across different interaction methods. The command intelligently respects the XDG Base Directory Specification for determining the trash location, which is typically found at ~/.local/share/Trash on most Linux systems. Unlike the rm command, which permanently deletes files, gvfs-trash offers a non-destructive way to remove files from their current location while keeping them accessible for potential restoration.
CAVEATS
- gvfs-trash relies on GVFS being installed and running, which is standard in GNOME-based desktop environments.
- When used without the --empty option, it expects file paths as arguments. If no files are specified on the command line, it reads file paths from standard input, one per line.
- Files moved to the trash bin still consume disk space until the trash is explicitly emptied.
- It may not function as expected on non-GVFS managed file systems or if the gvfsd daemon is not running.
- Trash functionality is typically per-user; items trashed by one user are not directly accessible from another user's trash bin.
STANDARD INPUT USAGE
gvfs-trash is capable of accepting file paths from standard input. If no file arguments are provided on the command line, it will read file paths (one per line) from stdin. This feature is particularly useful for piping output from other commands, for instance, find . -name "*.tmp" | gvfs-trash to trash all temporary files found in the current directory tree.
TRASH LOCATION
The user's trash bin location is typically defined by the XDG Base Directory Specification, commonly found at ~/.local/share/Trash. Within this directory, trashed items are stored in the files/ subdirectory, while associated metadata (such as original path and deletion date) is stored in the info/ subdirectory. This structured approach helps manage and restore trashed files effectively.
HISTORY
gvfs-trash is an integral part of the GVFS (GNOME Virtual File System) project, which was developed to supersede the older GNOME VFS library. GVFS provides a modern, modular, and extensible architecture for managing various file systems and protocols within the GNOME desktop environment. gvfs-trash was introduced as a convenient command-line utility to interact seamlessly with the standard trash mechanism provided by GVFS, thereby aligning the command-line file management experience with the graphical desktop's familiar "move to trash" functionality. Its ongoing development reflects the evolution of the GNOME desktop itself, emphasizing user convenience, consistency, and data safety.