trashy
Move files/directories to the trash
TLDR
Move a specific file to the trash
Move specific files to the trash
List items in the trash
Restore a specific file from the trash
Remove a specific file from the trash
Restore all files from the trash
Remove all files from the trash
SYNOPSIS
trash-put [OPTIONS] FILE...
PARAMETERS
-h, --help
Displays help message and exits.
-v, --verbose
Displays verbose output, showing details of the operation.
DESCRIPTION
The term "trashy" often refers to command-line utilities that mimic the graphical desktop environment's 'Trash' or 'Recycle Bin' functionality. Instead of permanently deleting files like the rm command, a "trashy" command moves files to a special, hidden directory from which they can potentially be recovered later. The most widely used and robust implementation for Linux command-line users is provided by the trash-cli package.
trash-cli offers a suite of commands: trash-put (to move files to trash), trash-list (to view trashed files), trash-restore (to recover files), trash-empty (to permanently delete all trashed files), and trash-rm (to permanently delete specific trashed files). This provides a crucial safety net against accidental data loss, making it a preferred alternative to rm for many users.
CAVEATS
The command 'trashy' itself is not a standard Linux utility. This analysis refers to the functionality typically provided by the popular third-party package 'trash-cli'.
Installation of trash-cli is required (e.g., sudo apt install trash-cli or pip install trash-cli).
Files are not immediately deleted but moved to a trash directory, typically ~/.local/share/Trash in compliance with the XDG Base Directory Specification. This means the files still consume disk space until the trash is emptied.
THE <B><I>TRASH-CLI</I></B> SUITE
Beyond trash-put, the trash-cli package provides several other commands crucial for managing trashed files:
trash-list: Lists all files currently in the trash, along with their original paths and deletion dates.
trash-restore: Allows interactive restoration of files from the trash to their original location or a specified directory.
trash-empty: Permanently deletes all files in the trash. It can also delete files older than a specified number of days or delete a specific number of oldest files.
trash-rm: Permanently removes specific files from the trash, identified by their trash ID or name. This is for selective permanent deletion within the trash.
HISTORY
The concept of a 'trash can' or 'recycle bin' originated in graphical user interfaces (GUIs) to prevent accidental file deletion. On the command line, users traditionally relied on rm, which offers no recovery. Various scripts and utilities emerged to bridge this gap, with trash-cli becoming one of the most prominent and widely adopted solutions for Linux command-line environments. Its development aimed to provide a robust, cross-desktop-compatible trash utility, adhering to the FreeDesktop.org Trash specification, enabling seamless interaction with GUI trash functionality.
SEE ALSO
rm(1), mv(1), find(1), gvfs-trash(1)