trash-list
List files in the trash can
TLDR
View documentation for trash-list
SYNOPSIS
trash-list [-l | --long] [-a | --absolute] [-r | --relative] [PATTERN...]
PARAMETERS
-l, --long
Displays detailed information for each trashed item, including its original path, deletion date, and size.
-a, --absolute
Shows the original absolute path for each trashed item. This is often the default behavior.
-r, --relative
Shows paths relative to the trash directory (e.g., files/ or info/ subdirectories), which might be less intuitive for general use.
PATTERN...
Filters the list of trashed items to display only those matching the specified pattern(s). Patterns can be filenames or parts of original paths.
DESCRIPTION
trash-list is a utility from the trash-cli package, providing a safe alternative to rm by moving files to a trash directory instead of permanent deletion. Specifically, trash-list allows users to view the files and directories currently residing in their trash. It typically displays crucial information such as the original absolute path of the deleted item, the date and time of its deletion, and its size.
This command is essential for users who wish to review deleted items before proceeding with recovery using trash-restore or permanent removal via trash-empty. Adhering to the XDG Base Directory Specification, trash-list inspects the standard trash location, usually ~/.local/share/Trash, making it a reliable tool for managing user's trashed content and understanding what occupies space within the trash bin. It offers a more user-friendly and informative interface compared to manually navigating the hidden trash directories.
CAVEATS
trash-list is part of the trash-cli project and is not a standard core utility; it may need to be installed separately. It strictly adheres to the XDG Trash specification and only manages files trashed using trash-cli commands, not files deleted by other methods like rm or potentially desktop environment trash implementations if they use a different mechanism.
TRASH LOCATION
trash-list reads the contents of the trash directories defined by the XDG Base Directory Specification. The primary trash location is typically ~/.local/share/Trash. This directory contains two crucial subdirectories: files (where the actual trashed items are stored) and info (which contains corresponding .trashinfo files with metadata).
METADATA (.TRASHINFO)
The rich information displayed by trash-list, such as the original path and deletion date, is extracted from .trashinfo files. For every item moved to the trash via trash-put, a corresponding .trashinfo file is created in the info subdirectory, detailing its original location and the timestamp of deletion.
HISTORY
The trash-cli project, which includes trash-list, was developed to provide a command-line interface adhering to the FreeDesktop.org Trash specification. Its primary goal is to offer a safer and more user-friendly alternative to the permanent deletion caused by commands like rm. trash-list has been a fundamental component of this suite since its early stages, providing users with essential visibility into their trashed items and facilitating trash management.
SEE ALSO
trash-put(1), trash-restore(1), trash-empty(1), trash(1), rm(1), ls(1)