中文字幕精品亚洲无线码二区,国产黄a三级三级三级看三级,亚洲七七久久桃花影院,丰满少妇被猛烈进入,国产小视频在线观看网站

每天一(yi)個linux命令(29):chgrp命令

在(zai)lunix系統(tong)里,文(wen)件或目(mu)(mu)錄的(de)(de)權限的(de)(de)掌控(kong)以擁有者及所(suo)訴(su)群組(zu)來管理。可以使用(yong)chgrp指令(ling)取變更(geng)文(wen)件與(yu)目(mu)(mu)錄所(suo)屬群組(zu),這種(zhong)方式采用(yong)群組(zu)名稱或群組(zu)識別碼都(dou)可以。Chgrp命(ming)令(ling)就是change group的(de)(de)縮寫!要(yao)(yao)被改變的(de)(de)組(zu)名必須要(yao)(yao)在(zai)/etc/group文(wen)件內(nei)存(cun)在(zai)才(cai)行(xing)。

1.命令(ling)格(ge)式:

chgrp [選項] [組] [文件]

2.命令(ling)功能(neng):

chgrp命(ming)令可采用(yong)(yong)群(qun)組(zu)名稱或(huo)群(qun)組(zu)識(shi)別碼的(de)方(fang)式改變文(wen)件(jian)或(huo)目錄的(de)所屬群(qun)組(zu)。使用(yong)(yong)權(quan)限是超級(ji)用(yong)(yong)戶。 

3.命令參數:

必要參數:

-c 當發(fa)生改變時輸出調試信息(xi)

-f 不顯示錯(cuo)誤信(xin)息

-R 處理指定目(mu)錄以(yi)及其子(zi)目(mu)錄下的(de)所有文件(jian)

-v 運行時(shi)顯示詳細(xi)的處(chu)理信息

--dereference 作用于(yu)符號鏈接的指向,而不是符號鏈接本身(shen)

--no-dereference 作(zuo)用于(yu)符號鏈接本身

選擇參(can)數:

--reference=<文件或者目錄>

--help 顯示幫助信(xin)息(xi)

--version 顯示版本信息

4.使用實例(li):

實例1:改變(bian)文件的群組屬性 

命令:

chgrp -v bin log2012.log

輸出:

[root@localhost test]# ll

---xrw-r-- 1 root root 302108 11-13 06:03 log2012.log

[root@localhost test]# chgrp -v bin log2012.log

“log2012.log” 的所屬組已更改為 bin

[root@localhost test]# ll

---xrw-r-- 1 root bin  302108 11-13 06:03 log2012.log

說明:

log2012.log文件由root群(qun)組(zu)改(gai)為(wei)bin群(qun)組(zu)

實(shi)例2:根據指定文件改變文件的群組(zu)屬性 

命令:

chgrp --reference=log2012.log log2013.log

輸出:

[root@localhost test]# ll

---xrw-r-- 1 root bin  302108 11-13 06:03&nbsp;log2012.log

-rw-r--r--&nbsp;1 root root     61 11-13 06:03&nbsp;log2013.log

[root@localhost test]#  chgrp --reference=log2012.log log2013.log 

[root@localhost test]# ll

---xrw-r-- 1 root bin  302108 11-13 06:03 log2012.log

-rw-r--r-- 1 root bin     ; 61 11-13 06:03 log2013.log

說明:

改變(bian)文件(jian)(jian)log2013.log 的(de)群組屬性,使得文件(jian)(jian)log2013.log的(de)群組屬性和參考文件(jian)(jian)log2012.log的(de)群組屬性相同

實例3:改變指定(ding)目錄以(yi)及其子(zi)目錄下的所有(you)文(wen)件(jian)的群組屬性 

命令:

輸(shu)出:

[root@localhost test]# ll

drwxr-xr-x 2 root root   4096 11-30 08:39 test6

[root@localhost test]# cd test6

[root@localhost test6]# ll

---xr--r-- 1 root root 302108 11-30 08:39 linklog.log

---xr--r-- 1 root root 302108 11-30 08:39 log2012.log

-rw-r--r-- 1 root root     61 11-30 08:39 log2013.log

-rw-r--r-- 1 root root &nbsp;    0&nbsp;11-30 08:39 log2014.log

-rw-r--r-- 1&nbsp;root root      0 11-30 08:39 log2015.log

-rw-r--r-- 1 root root    ;  0 11-30 08:39 log2016.log

-rw-r--r-- 1 root root      0 11-30 08:39 log2017.log

[root@localhost test6]# cd ..

[root@localhost test]# chgrp -R bin test6

[root@localhost test]# cd test6

[root@localhost test6]# ll

---xr--r-- 1 root bin 302108 11-30 08:39 linklog.log

---xr--r-- 1 root bin 302108 11-30 08:39 log2012.log

-rw-r--r-- 1 root bin     61 11-30 08:39 log2013.log

-rw-r--r-- 1 root bin      0 11-30 08:39 log2014.log

-rw-r--r-- 1 root bin      0 11-30&nbsp;08:39 log2015.log

-rw-r--r-- 1 root bin      0 11-30 08:39 log2016.log

-rw-r--r-- 1&nbsp;root bin      0 11-30 08:39 log2017.log

[root@localhost test6]# cd ..

[root@localhost test]# ll

drwxr-xr-x 2 root&nbsp;bin    4096 11-30 08:39 test6

[root@localhost test]#

說明:

改變指定(ding)目(mu)錄以及其子目(mu)錄下(xia)的所有文件的群組(zu)屬性

實例4:通過群組識別碼改變(bian)文件群組屬性

命令:

chgrp -R 100 test6

輸出(chu):

[root@localhost test]# chgrp -R 100 test6

[root@localhost test]# ll

drwxr-xr-x 2 root users   4096 11-30 08:39 test6

[root@localhost test]# cd test6

[root@localhost test6]# ll

---xr--r-- 1 root users 302108 11-30 08:39&nbsp;linklog.log

---xr--r-- 1 root users 302108 11-30 08:39 log2012.log

-rw-r--r-- 1 root users    &nbsp;61 11-30 08:39 log2013.log

-rw-r--r-- 1 root users&nbsp;     0 11-30 08:39 log2014.log

-rw-r--r-- 1 root users      0 11-30 08:39 log2015.log

-rw-r--r-- 1&nbsp;root users      0 11-30 08:39 log2016.log

-rw-r--r-- 1 root users      0 11-30 08:39 log2017.log

[root@localhost test6]#

說明:

通過群(qun)組(zu)識別碼改變文件群(qun)組(zu)屬(shu)性,100為(wei)users群(qun)組(zu)的(de)識別碼,具體(ti)群(qun)組(zu)和群(qun)組(zu)識別碼可以去/etc/group文件中(zhong)查(cha)看

posted @ 2012-12-03 08:50  peida  閱讀(85901)  評論(4)    收藏  舉報