Delete to the recycle bin with gio trash

gio trash sends files to the standard desktop Trash (recoverable from Files/Nautilus), unlike rm which deletes immediately and forever.

LinuxtrashdesktopgioLow risk
Run `gio trash <file>` to trash; restore with `gio trash --restore trash:///<name>` or open the Trash in your file manager.

01Command

Command
$ gio trash notes.txt

02What it does

gio trash follows the FreeDesktop trash specification: files move to ~/.local/share/Trash with their original path recorded, so 'Delete' in the terminal behaves like 'Move to Trash' in the file manager. `gio list trash:///` and `gio trash --empty` manage the bin from the terminal, and gio works over gvfs even for remote locations.

03Risk

RiskLow risk
Requirementsglib2 / gvfs (preinstalled on GNOME, Cinnamon, etc.)
!Warning: Trash does not free disk space until emptied; very large files are better moved or deleted outright. On NFS or FAT volumes without a writable trash, gio may fall back to asking for a real delete.

04Undo

Undo
$ gio trash --restore trash:///<name>

05Sources

Last verified: 2026-09-18 · Category: Files & Folders