為了方便初學者記憶,可以將 chgrp 理解為是 "change group" 的縮寫。
chgrp 命令的用法很簡單,其基本格式為:[root@localhost ~]# chgrp [-R] 所屬組 文件名(目錄名)
-R(注意是大寫)選項長作用于更改目錄的所屬組,表示更改連同子目錄中所有文件的所屬組信息。[root@localhost ~]# groupadd group1
#新建用于測試的群組 group1
[root@localhost ~]# chgrp group1 install.log
#修改install.log文件的所屬組為group1
[root@localhost ~]# ll install.log
-rw-r--r--. 1 root group1 78495 Nov 17 05:54 install.log
#修改生效
[root@localhost ~]# chgrp testgroup install.log
chgrp: invaild group name 'testgroup'
新聞熱點
疑難解答