Linux chown -R参数,是什么意思

时间:2023-02-06 16:43:31

The explanation is:

解释是:

"-R, --recursive

“-R, - 递归

operate on files and directories recursively"

以递归方式对文件和目录进行操作“

What does "recursive" mean here?

“递归”在这里意味着什么?

3 个解决方案

#1


49  

"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

将文件所有者更改为foo中/ some / path中的所有文件和目录

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

附:您甚至可能已经看到了递归的字典条目:

recursive, n: See recursive

递归,n:请参阅递归

#2


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.

在某些Linux命令中,如果在带-R的文件夹上运行该命令,该命令将对该文件夹树中的所有文件和文件夹进行操作。如果在文件上运行该命令,则-R无效。

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.

在此示例中,-n用于显示行号。

#3


2  

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

这意味着将它应用于子目录及其内容,即在遇到目录时递归chown()。

#1


49  

"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

将文件所有者更改为foo中/ some / path中的所有文件和目录

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

附:您甚至可能已经看到了递归的字典条目:

recursive, n: See recursive

递归,n:请参阅递归

#2


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.

在某些Linux命令中,如果在带-R的文件夹上运行该命令,该命令将对该文件夹树中的所有文件和文件夹进行操作。如果在文件上运行该命令,则-R无效。

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.

在此示例中,-n用于显示行号。

#3


2  

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

这意味着将它应用于子目录及其内容,即在遇到目录时递归chown()。