Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So my command line skills are a little rusty and I'm having trouble remembering the differences between the meanings of flags in different distro's os's. I also don't really remember all my technical lingo so manpages seem really unclear.

Basically I'm on Mac OS X and want to delete a directory along with all of its contents. What I'm mainly concerned about, I suppose, is that it'll delete literally ALL of the references within the directory, including ../ and ../<everything else, including ../'s own ../> and then just totally screw up my entire system.

Which of these do I want to run?

$ rm -R dir-name/


$ rm -r
share|improve this question
Jon, please click the checkmark next to one of the responses if they answer your question. This will mark your problem solved and reward the person answering. – Daniel Beck Feb 25 '11 at 21:30

If you want to delete foo/bar, the command you want is rm -r foo/bar (assuming you are working in the directory that contains foo). This will delete bar and everything in it, but leave foo and anything else in it alone.

rm -r is clever enough not to recurse into ../ - otherwise every rm -r would delete everything.

share|improve this answer

If you run:

rm -r

without passing it a directory/file argument, nothing will happen.

There is no difference between:

rm -r xyz
rm -R xyz
rm -r xyz/


share|improve this answer
thanks for the help, appreciate it. – Jon Feb 25 '11 at 9:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .