Chgrp

来自 ChinaUnix Wiki

Linux命令:chgrp

功能说明: 变更文件或目录的所属群组。 
语  法:chgrp [-cfhRv][--help][--version][所属群组][文件或目录...] 或 chgrp [-cfhRv][--help][--reference=<参考文件或目录>][--version][文件或目录...] 
补充说明:在UNIX系统家族里,文件或目录权限的掌控以拥有者及所属群组来管理。您可以使用chgrp指令去变更文件与目录的所属群组,设置方式采用群组名称或群组识别码皆可。 
参  数:
-c或--changes  效果类似"-v"参数,但仅回报更改的部分。 
-f或--quiet或--silent  不显示错误信息。 
-h或--no-dereference  只对符号连接的文件作修改,而不更动其他任何相关文件。 
-R或--recursive  递归处理,将指定目录下的所有文件及子目录一并处理。 
-v或--verbose  显示指令执行过程。 
--help  在线帮助。 
--reference=<参考文件或目录>  把指定文件或目录的所属群组全部设成和参考文件或目录的所属群组相同。 
--version  显示版本信息。

英文版本,欢迎翻译:

ABOUT CHGRP

For system V, changes the group that has access to a file or directory.

SYNTAX

chgrp newgroup filenames [-f] [-h]

newgroup Specifies the new group that you wish to allow access to. filenames Specifies the files that the newgroup has access to. -f Force. Do not report errors. -h If the file is a symbolic link, change the group of the symbolic link. Without this option, the group of the file referenced by the symbolic link is changed. -R Recursive. chgrp descends through the directory, and any subdirectories, setting the specified group ID as it proceeds. When a symbolic link is encountered, the group of the target file is changed (unless the -h option is specified), but no recursion takes place.


EXAMPLES

chgrp hope file.txt - Would change the group to hope for the file file.txt if present and the group hope is valid.

个主工具