Delete files safely with trash-cli

Send files to the desktop trash instead of destroying them with rm — recoverable until you empty it.

LinuxdeleteFilesLow risk
Run trash-put file-or-folder to trash it, trash-list to see what's there, and trash-restore to get something back.

01Command

Command
$ trash-put old-drafts/ && trash-list && trash-restore

02What it does

rm is forever: there is no recycle bin at the shell. trash-cli implements the freedesktop trash spec, so files deleted with trash-put appear in the same trash your file manager uses. trash-list shows contents with original paths and deletion times, trash-restore walks you through putting items back, and trash-empty purges everything.

03Risk

RiskLow risk
Requirementstrash-cli package (pip install trash-cli, or apt install trash-cli); needs a freedesktop trash backend
!Warning: Trashed files still occupy disk space until the trash is emptied — a 'deleted' 20 GB video isn't really gone. Also note trash-cli must be installed separately; it's not part of a base install.

04Undo

Undo
$ trash-restore (picks a trashed item and puts it back)

05Sources

  • Trash management — Arch Wiki
    Arch Linux · community · 2026-09-17
    Evidence: Documents the freedesktop.org trash specification and trash-cli tools (trash-put, trash-list, trash-restore) as the safe-deletion workflow on Linux.

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

06Related solutions