LinuxCommandLibrary

trash-restore

Restore files from the trash/recycle bin

TLDR

View documentation for trash-restore

$ tldr trash
copy

SYNOPSIS

trash-restore [OPTION]... [FILE]...

PARAMETERS

-h, --help
    Display help information and exit.

-v, --verbose
    Be verbose during operation.

-i, --interactive
    Asks confirmation to restore each file.

--version
    Output version information and exit.

[FILE]...
    Specify which files to restore. If no file is provided will offer a menu to choose from

DESCRIPTION

The trash-restore command is a utility used to recover files that have been previously moved to the system's trash directory (often ~/.local/share/Trash). This command allows users to browse the trash contents, identify the desired files, and restore them to their original locations or to a user-specified location.

Unlike simply moving files out of the trash directory manually, trash-restore handles potential filename conflicts by renaming the restored file (e.g., adding a suffix like ".1"). It also ensures that the file's original permissions and timestamps are preserved as accurately as possible.

This command is part of the `trash-cli` suite, which provides a set of command-line tools for managing the trashcan on Linux systems, mimicking the functionality of graphical trash can implementations.

FILE CONFLICTS

If a file with the same name already exists in the destination directory, `trash-restore` will automatically rename the restored file to avoid overwriting the existing file. It typically appends a number to the filename (e.g., 'file.txt.1', 'file.txt.2').

PERMISSIONS

The restored file will retain its original permissions and timestamps as they were before the file was trashed.

HISTORY

The `trash-cli` tools, including `trash-restore`, were developed to provide a standardized command-line interface for interacting with the trashcan on Linux systems. Before `trash-cli`, command-line users often had to manually manage the trash directory, which was less efficient and prone to errors. The development of `trash-cli` aimed to offer a more convenient and reliable way to handle file deletion and restoration from the command line, mirroring the experience of graphical desktop environments.

SEE ALSO

Copied to clipboard