When you want get rid of some files, but fully deleting them is bit drastic, a trash can is an handy option. In a graphical environment the tools are there to do it (drag and drop, right mouse button on a file, etc.), but on the command line it is not something very handy to do. In the old days there was a directory
~/Desktop/Trash that acted as the trash can. But nowadays, KDE and Gnome implement the freedesktop.org trash specification, which is more advanced than a simple directory with files. This makes it less straightforward to access the trash can from the command line.
When KDE is installed, the KDE file manager can be used from the commandline to do it:
$> kfmclient move foobar.txt trash:/
foobar.txt to the trash can.
To make it a bit more user friendly, you can put the following script in a directory in your
$PATH, call it something like
totrash and make it executable:
#!/bin/bash # Move files to trash:/ kfmclient move "$@" trash:/
On the commandline you only need then
$> totrash foobar.txt pleezeew.hu
and you're done.