6

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?

migrated from stackoverflow.com Feb 7 '10 at 3:32

This question came from our site for professional and enthusiast programmers.

  • 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 Feb 7 '10 at 3:13
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.

  • +1 At least someone explains what that -i actually means. – fretje Feb 7 '10 at 13:58
5

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

check your shell alias.

2

Also consider calling it as: yes | rm -rf

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.