KTrash - Kde 3.4+ compatible command line trash can.


KTrash [--] FILE(s) : trash files
KTrash : list contents of trashcan
KTrash -l | -s : list contents of trashcan with properties
KTrash -r FILE(s) : recover files to current directory
KTrash -R FILE(s) : restore files to original locations
KTrash -e : empty trash can


KTrash is a feature incomplete command line trash for more recent versions of KDE.


Currently KTrash moves all deleted files to the filesystem containing $HOME. It is unaware of files on other volumes that have been deleted by Konqueror (for example /mnt/knoppix/.Trash-0).

Like Konqueror, KTrash will backup files of the same name by appending _1, _2, etc. and remember the file’s original location.

AFAIK KTrash can handle all unusual filenames, and in a manner consistent with Konqueror. It is possible that exceptions exist as this is a little technical %-/

KTrash -l will list the sizes of all trashed files/directories, and sort output.

KTrash has a safety feature. If the first arg is "mv", it will exit. To trash a file named "mv" use "KTrash -- mv".


The KTrash utility can be used to quickly remove (and optionally restore) files spread around a directory tree.
To remove all files matching "*ounce*":
   KTrash -e

   find /opt/kde -iname "*ounce*" | xargs KTrash

and to restore:
   KTrash -R "*"


KTrash -r "a b" doesn’t work. (KTrash -r "a*" does).

See the notes (above) about local filesystems and special characters.

See Also



Steven Atkinson (stevenaaus (at) yahoo (dot) com)