Trashing on the command line: trash-cli

While KDE and other desktop environments usually keep removed files in a trash directory, the command line program rm irreversibly deletes files. The tiny Python utility trash-cli may help here. It implements the Freedesktop trash specification and is therefore apt for Gnome and KDE. On Ubuntu, it can be installed from the package management:

sudo apt-get install trash-cli

The manpage in my version (0.12.7) is a little outdated, so I list the available programs here:

  • trash, trash-put f – moves file or directory f to trash
  • trash-empty [d] – empties the trash (optionally restricted to files that are older than d days)
  • restore-trash – restores files that were originally located below the current directory
  • trash-list – lists all files in the trash (trash-list | sort sorts the files according to date)


  • [1] trash-cli project site
  • [2] Freedesktop trash specification

Leave a Reply