The Ubuntu community has contributed 12357 ideas, 58479 comments, 1187050 votes
Idea
#3392: Change 'rm' command to send files to the Trash instead of instant deletion
|
| |
-73
|
|
|
Written by xiota the 5 Mar 08 at 19:31.
Category: System.
Related to:
Nothing/Others.
Status: New
|
|
|
Description
The 'rm' command, typed at the terminal, is dangerous and irreversible. Instead of deleting files immediately, 'rm' should send files to the Trash. This would be useful in cases where users might type something like 'rm -r temp *', when 'rm -r temp\ *' is intended. (Warning: Do not try those commands. I include them here for illustrative purposes only.)
Tags:
(none)
Attachments
No attachments.
Duplicates
Comments
|
jannone wrote on the 5 Mar 08 at 21:07
|
This is not good. It would mess with the POSIX standard.
Instead, I suggest you implement your own rm wrapper, call it "rmt" or something... but never really replace rm itself, because there are numerous core scripts that are dependent on the original behavior, and of course, there would be a lot of other impacts in performance and such.
|
|
xiota wrote on the 5 Mar 08 at 21:15
| |
This idea could be implemented as an alias, like how making 'rm' default to 'rm -i' is commonly implemented. The original 'rm' command would be left intact. Core scripts shouldn't be affected because they ignore normal users' aliases.
|
|
maix wrote on the 5 Mar 08 at 21:38
|
Put alias del='mv -t ~/.Trash --backup=t' into your ~/.bashrc.
Replacing rm by rm -i is a very bad idea: Once this is not available, e.g. on another computer or when you're in a root shell, ... you expect rm to ask you, but it does not. Using another command for that creates a command not found message, and you'll remember and either set the alias or be careful.
|
|
cheesehead wrote on the 6 Mar 08 at 01:38
|
This is a very good idea...phrased poorly.
The .bashrc script (thanks, maix) meets the intent without damaging the system.
I'm voting 'up' because the community has successfully found a solution... and it's a real problem (I've just never been bitten by it - yet).
|
|
logfish wrote on the 8 Mar 08 at 22:14
|
The solution (for Hardy) is the following:
1) Open a terminal
2) Run the command:
echo alias del=gvfs-trash >> ~/.bashrc
You can also do this for the default "rm", using rm instead of "del" in the above command, but because this won't work with scripts and won't work everywhere you SSH to, it may become confusing if you rename rm.
Also note that using the suggestion by maix is won't correctly add the meta information and as of Hardy your trash is somewhere in "~/.local/share/Trah"
|
Post your comment
|
|
|