33

The explanation is:

"-R, --recursive

operate on files and directories recursively"

What does "recursive" mean here?

alex
  • 479,566
  • 201
  • 878
  • 984
nomnom
  • 1,560
  • 5
  • 17
  • 31
  • 5
    This question appears to be off-topic because it is about English language. –  Jul 13 '13 at 10:35
  • 2
    Search here: http://google.com/search?q=recursion –  Jul 13 '13 at 10:35
  • 2
    See this question for recursion: http://stackoverflow.com/questions/17629046/linux-chown-r-parameter-what-does-it-mean – Étienne Jul 13 '13 at 10:53

3 Answers3

65

"Recursive" implies that the operation will be performed for all files and directories (and all files and directories within any directory). So

chown -R foo /some/path

would change file owner to foo for all files and directories in /some/path

p.s. You might have even seen the dictionary entry for recursive:

recursive, n: See recursive

The Unknown Dev
  • 3,039
  • 4
  • 27
  • 39
devnull
  • 118,548
  • 33
  • 236
  • 227
3

In some Linux commands, if you run the command on a folder with -R, the command will operate on all files and folders in that folder's tree. If you run the command on a file, -R has no effect.

The command will operate on given folder, and recursively operates on files and folders within it. It is based on recursion.

For example, you can remove a folder and its contents with

rm -R folder-name

Or you can find all occurrences of a specific string in all files within current folder tree with

grep -R -n the-string . 

In this example -n is for displaying line numbers.

2

It means apply it to sub-directories and their contents, that is, recurse chown() when a directory is encountered.

alex
  • 479,566
  • 201
  • 878
  • 984