LinuxCommandLibrary

trash-empty

Empty the trash can

TLDR

View documentation for trash-empty

$ tldr trash
copy

SYNOPSIS

trash-empty [options]

PARAMETERS

-d, --days DAYS
    Delete only files that were trashed before DAYS days ago.

-f, --force
    Force to empty the trash without asking for confirmation.

-v, --verbose
    Enable verbose mode. Display deleted items.

-V, --version
    Display version information and exit.

-h, --help
    Display this help message and exit.

DESCRIPTION

The `trash-empty` command is a utility, often part of a larger trash management system (like `trash-cli`), used to permanently delete files and directories residing in the user's trash or recycle bin. Unlike simply deleting files with `rm`, sending files to the trash allows for accidental deletion recovery. `trash-empty` provides a mechanism to completely remove these trashed items, freeing up disk space.

When executed, `trash-empty` typically iterates through the trash directory (usually located in `$HOME/.local/share/Trash`) and permanently removes the files and directories it finds there. Without further options, it empties all trashed items irrespective of date. The `trash-empty` command is vital for ensuring data privacy and freeing up storage space on a regular basis. It allows you to perform permanent clean up of deleted files.

RETURN CODES

The `trash-empty` command returns 0 on success, and a non-zero value on failure (e.g., due to permission issues, missing files, or internal errors).

CONFIGURATION

The trash location is determined by the Freedesktop.org Trash Specification and typically resides in `$HOME/.local/share/Trash`. Some desktop environments may modify this location, but `trash-cli` tools generally handle these variations correctly.

HISTORY

The `trash-empty` command is usually part of the `trash-cli` suite of tools. These tools were developed to provide a Freedesktop.org Trash Specification compliant command-line interface for managing the trash/recycle bin on Linux systems. The development aimed to provide a safer alternative to the `rm` command, offering a way to recover accidentally deleted files before permanently removing them. The adoption of `trash-cli` has grown over time as users sought better control over their deleted files from the command line.

SEE ALSO

Copied to clipboard