Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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/

or

$ 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
add comment

2 Answers

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
add comment

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/

etc.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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