Ubuntu QA:
BlogBrainstormPackage status
Log in
Ubuntu QA
The Ubuntu community has contributed 21545 ideas, 132412 comments, 2606687 votes
Idea sandbox Idea sandbox
Popular ideas Popular ideas
Ideas in development Ideas in development
Implemented ideas Implemented ideas
Idea #1864: rm -i by default

bug This idea was marked as being not considered for implementation the 25 September 11.
Written by Arnaudus the 29 Feb 08 at 21:54. Category: System. Related project: Nothing/Others. Status: Won't implement
Rationale
By default, the command "rm" does not prompt any confirmation before definitely erasing a file. This can be a problem, because:

* Windows users are used to the "Trashbin" thing, and may not really understand that removing a file actually deletes in definitely (different behavior when removing a file with the mouse and with a command line)
* On some other Linux distributions I know, this behavior is activated by default, such as one might expect this as the default setting, and might rely on it (I know, it's a bit stupid, but I've already done that)
* Even if advanced users can claim that they don't need the -i, actually, they do. Everyone does. In any case, it's possible to use " rm -f " in the cases where -i is really boring.
Tags: (none)

-87
votes
closed
Solution #1: Define an alias: alias rm='rm -i' by default
Written by Arnaudus the 29 Feb 08 at 21:54.
This could be avoided by activating the -i option by default (for instance, I always define " alias rm='rm -i' " in my .bashrc). This can be particularly useful to activate this option when using sudo.

Propose your solution

Attachments
No attachments.


Duplicates


Comments
Greyor wrote on the 29 Feb 08 at 21:57
I dunno. I think people need to take more responsibility. If you're going to use rm, then use it carefully.

jamaris wrote on the 29 Feb 08 at 21:58
Ubuntu users will most probably not use the command line and therefore have no need for -i. Advanced users who do use the commandline will be annoyed by -i, so no -i please.

tantalanta wrote on the 29 Feb 08 at 22:06
It gets really annoying if you have thousands of files and in addition do the rm with -R option.

berlinbrown wrote on the 29 Feb 08 at 22:14
People should learn to use 'alias'. That isn't that hard to configure.


Leonivek wrote on the 29 Feb 08 at 22:40
I agree with berlinbrown... Learn to use 'alias'.

http://en.wikipedia.org/wiki/Alias_%28Unix_shell%29

Ssdg wrote on the 29 Feb 08 at 23:13
As far as I'm concern, why should our (wonderful and great) developers add a system-wide alias just in order to be disabled by most people using the command line (if -i is an option, there is a reason )

and do you really think a windows user will delete his/her files via command line, It might be specific to my friends, but when I say "open a command line" they open wide eyes, and say: "a what?" even using windows or linux. (command line might be useful on windows to manage networks.)

Hawke wrote on the 29 Feb 08 at 23:14
But perhaps Ubuntu should have this alias on by default. Those who don't want it are probably knowledgeable enough to turn it off

Stebalien wrote on the 1 Mar 08 at 00:25
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

rm -i should be default when running it with sudo.
I have not found a way to alias rm to rm -i with sudo (other than replacing the rm executable).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHyKIS2FSfVyUro4URAvwCAJwMUVgSenkXmq8/8gyOUibVBaw2pgCeJWd/
Z1eEIvuIJBrEKRO4stYsrQc=
=4AOw
-----END PGP SIGNATURE-----

Arnaudus wrote on the 1 Mar 08 at 13:11
OK, seems that my idea is not so successful, too bad. It was probably partly misunderstood, so just a few comments:

@jamaris: "Advanced users who do use the commandline will be annoyed by -i" : I don't think so. Any advanced user can add the -f when they plan to delete a lot of files. Even advanced users sometimes do stupid things, and the -i prompt help a lot thinking twice before deleting something. Anyway, if an advanced user is annoyed with -i, it's very easy for him to add an alias for rm -f. Just a try: go to a Linux forum and claim you're an advanced user and you've defined an alias for rm -f. If the answer is "fortune!", don't think you're going to be rich :-)

@tantalanta: "It gets really annoying if you have thousands of files", that's exactly why the -f option exists.

@Leonivek: Please, read the text I wrote instead of guessing what I meant from the previous comments...

@Hawke: "But perhaps Ubuntu should have this alias on by default." That was exactly the idea. Sorry of it was not so clear.

@Stebalien: You're right, it should be the case at least with sudo.

cheesehead (Brainstorm admin) wrote on the 2 Mar 08 at 14:35
It's a good idea. I simply don't like it.
(because I haven't been burned badly by rm...yet)

schwern wrote on the 31 Dec 08 at 01:39
Don't mean to raise this idea from the dead, it seems to have been properly mooted, but I haven't seen mentioned the real reason "rm -i" is a bad idea: it doesn't actually work.

"Work" in the sense of do the intended job of preventing the user from deleting files they don't mean to delete. In a nutshell, because the response to the "are you sure?" query is almost always going to be yes, the user will quickly be trained to hit "y" before really reading and understanding the warning. It's only in the split-second after they delete the file that they realize they did not want to do that. By that point, it's too late.

You wind up with a nagging interface, users trained to ignore "are you sure?" dialogs and still the wrong files get deleted.

IF you're going to change 'rm' to make it safer, a debate in and of itself, changing it to move files to the trash actually has the desired effect without the nags.

Full write up here:
http://use.perl.org/~schwern/journal/38188


Post your comment