Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Newbie here. Can someone please explain what it means to do something "recursively", in plain language? I have looked at search results for HOURS without finding anything that simply says what it means in plain English. For example, if I use the -r option with chown, what does that do?

Thanks!

share|improve this question

closed as off topic by HopelessN00b, Michael Hampton, Wesley, voretaq7 Nov 26 '12 at 23:04

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

17  
To understand recursion, one must first understand recursion. –  smcg Nov 26 '12 at 22:58
1  
3  
Googling recursion gives you the answer (in a cryptic way) in the did you mean box –  Mark Henderson Nov 26 '12 at 22:59
    
Recursion –  Wesley Nov 26 '12 at 23:00
    
This is where Wikipedia comes in handy. Or Google's little joke about it. Did you mean recursion? –  HopelessN00b Nov 26 '12 at 23:06

1 Answer 1

up vote 5 down vote accepted

So, in order to curb everyone joking around, here's a serious answer:

To do something recursively in this context means to apply whatever it is that you're doing to all the children of the object you're applying it to.

So, doing chown $HOME takes ownership of your home folder, but only the home folder, nothing inside it.

Doing chown -R $HOME (note the upper-case R) will take ownership of the home folder, and then go into the home folder, find all the objects (files and folders in this case), take ownership of them, and then check to see if those objects have any children that it can take ownership of too. Repeat and rinse until it runs out of things to take ownership of.

share|improve this answer
1  
/~? It works perfectly without the /, and you don't risk applying it to / ~ due to a typo. –  pgs Nov 26 '12 at 23:05
    
Thank you sir! I had somewhat gathered that that's what it meant, but I am reluctant to perform an operation on several terabytes of not-backed-up data without KNOWING what it means! Yes, I do plan to back it up, but first I must recover it! –  Bill Nov 26 '12 at 23:07
2  
@pgs - ok, so you're picking on the syntax of the particular command I chose? Not particularly constructive given that the example is extremely trivial given that it's only being used to demonstrate a point –  Mark Henderson Nov 26 '12 at 23:11
1  
@MarkHenderson It may not be a big deal to you, but I have trashed a server with a similar typo. Fortunately it was cleaning up after an upgrade, and I had good backups, so I only got to start again from scratch. I left work late that night. –  pgs Nov 27 '12 at 1:49
    
If in doubt, use a -v on such a recursive command so you see what it is doing and can intervene if what happens is different from what was expected... –  rackandboneman Dec 10 '12 at 7:34

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