Why does \rm work but rm doesn't?

6

2

Usually whenever I remove directories, "rm -rf " works. But sometimes I get this response:

"rm: examine files in directory / (yes/no)?"

Then I try "\rm -rf ", and that works. Can anyone explain why?

user27488

Posted 2010-02-07T02:02:44.540

Reputation: 61

If it asks you whether to examine the files in '/', do you say 'yes' or 'no'? And does the machine continue to work afterwards? Be very careful about deleting everything under root when running as root; the machine keeps going for a surprisingly long time, but there comes a point at which you have to reboot - off a CD or something similar. – Jonathan Leffler – 2010-02-07T03:13:10.910

Answers

10

Someone, either your system administrator or your linux distribution (you didn't specify what form of unix you are using) has aliased rm to rm -i. Take a look at what man rm says:

-i Request confirmation before attempting to remove each file, regardless of the file's permissions, or whether or not the standard input device is a terminal. The -i option overrides any previous -f options.

You can see the actual binding of any command with the which command: which rm will say something like:

rm: mapped to rm -i

To execute the real rm, type \rm, as you have already discovered.

Ether

Posted 2010-02-07T02:02:44.540

Reputation: 1 007

+1 At least someone explains what that -i actually means. – fretje – 2010-02-07T13:58:40.060

5

your rm command is alias, most likely rm -i.

check your shell alias.

unknown

Posted 2010-02-07T02:02:44.540

Reputation: 286

2

Also consider calling it as: yes | rm -rf

Fantomas

Posted 2010-02-07T02:02:44.540

Reputation: 399

2

Most of the new linux distro are making safy aliases

usually the rm command is aliased to rm -i.

You can remove that alias if you don't need it by doing rm='rm', also to make it automatic take a look at bash configuration files.

Good luck

RageZ

Posted 2010-02-07T02:02:44.540

Reputation: 216