gio-trash
Move files or directories to the trash
TLDR
Move specific files to the trash bin
List trash bin items
Restore a specific item from trash using its ID
SYNOPSIS
gio trash [OPTION...] [FILE...]
PARAMETERS
--empty
Empty the Trash completely
-h, --help
Show help and exit
--version
Print version information
DESCRIPTION
The gio trash command, part of GLib's GIO library, moves files or directories to the system's Trash bin instead of permanently deleting them. This follows the Freedesktop Trash specification, allowing easy restoration from ~/.local/share/Trash/. Unlike rm, it preserves files with metadata like deletion date in .TrashInfo files.
Invoke without options to trash specified paths. Use --empty to permanently delete all trashed items. Ideal for desktops with GVFS (GNOME Virtual File System), it integrates with Nautilus and other file managers. Operates over D-Bus, requiring a user session bus.
Supports local files but has limits on network shares or non-standard filesystems lacking trash portals. Files retain permissions and ownership in trash. Emptying reclaims space irreversibly. Common in Linux distributions with GNOME/KDE for safer file operations versus destructive removal.
CAVEATS
Needs GVFS/DBus session; limited on remote filesystems or without trash support. Files still occupy space until --empty. Not for root or system-wide use.
EXAMPLES
gio trash *.txt
Trash all .txt files.
gio trash --empty
Delete all trashed items.
gio trash /path/to/dir
Move directory to Trash.
TRASH LOCATIONS
User: ~/.local/share/Trash/ (files/ and info/).
Root/volume-specific: /path/.Trash-1000/ or similar.
HISTORY
Added in GLib 2.18 (2008) for GIO, implementing Freedesktop Trash spec. Evolved with GVFS for cross-DE compatibility; standard in modern distros.
SEE ALSO
rm(1), gvfs-trash(1), trash(1), shred(1)


