Linux command: CHGRP

Source: Internet
Author: User

chgrp Command Introduction:

command to change a filegroup (This command is available only to administrators)

1 . Command format:

Chgrp GROUPNAME Files

2 . Command function:

Commands for changing the group of folders

3 . Command parameters:

-R: Modify the genus Group (recursive modification) of the directory and its internal files and subdirectories

--reference=/path/to/somefile file,... Change the group of file files to

/path/to/somefile files as many files are separated by commas.

Eg: #chgrp--reference=/etc/passwd/etc/test/100.sh,/etc/test/200.sh

The group of 100.sh and 200.sh two files are changed to be consistent with the/etc/passwd file.

4 . Command instance:

1, chgrp Donggen 100.sh to change the genus Group of 100.sh files to Donggen

[Email protected] test]# ls-l

-rwxr-xr-x. 1 root root 273 September 19:49 100.sh change before group is root

[Email protected] test]# chgrp Donggen 100.sh

[Email protected] test]# ls-l

-rwxr-xr-x. 1 root donggen 273 September 19:49 100.sh This file belongs to a group that has been changed to Donggen

2. Chgrp Donggen/test1 Change the group of Test1 to Donggen

[Email protected]/]# Ls-ld/test1

Drwxr-xr-x. 2 root root 4096 October 16:36/test1 change before group is root

[Email protected]/]# chgrp donggen/test1

[Email protected]/]# Ls-ld/test1

Drwxr-xr-x. 2 root Donggen 4096 October The genus group for this directory has been changed to Donggen

3, Chgrp-r donggen/test the test group and its internal subdirectories and files of the group are modified

[Email protected]/]# ls-ld/test

Drwxr-xr-x. 2 root root 4096 October 09:21/test change the predecessor group to root

[[email protected]/]# ls-l/test

-rwxr-xr-x. 1 root    root 273 September  14 19:49 100.sh & nbsp before change group is root

-rwxr-xr-x. 1 root root 252 September 18:58 hadoop.sh change before group is root

-rwxr-xr-x. 1 root root 455 August 18:42 myar.sh change before group is root

[Email protected]/]# chgrp-r donggen/test

[Email protected]/]# ls-ld/test

Drwxr-xr-x. 2 root donggen 4096 October 09:21/test Test Catalog group changed to Donggen

[Email protected]/]# ls-l/test

root donggen 273 September  14 19:49 100.sh   Test Directory The file group is also changed to Donggen

root donggen 252 September  14 18:58 hadoop.sh  test Directory of the file belongs to

-rwxr-xr-x. 1 root donggen 455 August 18:42 myar.sh Test Directory The file group also changed toDong Gen


This article is from the "Learn Linux history" blog, please be sure to keep this source http://woyaoxuelinux.blog.51cto.com/5663865/1861701

Linux command: CHGRP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.