safely delete

Ulf Rompe Ulf.Rompe at icem.com
Thu Jan 11 09:50:31 UTC 2007


Am Mittwoch, den 10.01.2007, 16:03 +0100 schrieb Bram Kuijper:
> is there any equivalent to the rm command so that files are not
> getting deleted, but just moved to a thrash can?

No need for a package or a shell script. Just add this line to your
~/.bashrc :

alias rm="mv --target-directory=${HOME}/.Trash --backup=numbered"

That means: Every time you type "rm yada.txt" the shell reads it as "mv
--target-directory=${HOME}/.Trash --backup=numbered yada.txt". The
backup parameter enables a logic that moves the file as "yada.txt.~1~"
if "yada.txt" already exists in your trash can.

Please note that changing ~/.bashrc only affects shells opened after the
file has been saved. To reread it in an existing shell, just type
". ~/.bashrc". You may check your defined aliases by just typing
"alias", "alias rm" or "type -a rm".

[x] ulf 

-- 
Der Computer ist die logische Weiterentwicklung des Menschen:
Intelligenz ohne Moral. (John Osborne)





More information about the ubuntu-users mailing list