One Linux command per day (--CHGRP) command

Source: Internet
Author: User

In a Linux system, control over the permissions of a file or directory is managed by the owner and the group to which it belongs. You can use the CHGRP command to change the file and directory to belong to the group, this way with the group name or group identification code can be.

The CHGRP command is the abbreviation for Change group. The group name to be changed must exist within the/etc/group file.

1. Command format:

CHGRP [Options] [group] [file]

2. Command function:

The CHGRP command can change the group that the file or directory belongs to by using a group name or a group identifier. The usage permission is superuser.

3. Command parameters:

Necessary parameters:

-C Output Debug information when a change occurs

-F does not display error messages

-R handles all files in the specified directory and its subdirectories

-V Run-time display verbose processing information

--dereference acts on the point of a symbolic link, not the symbolic link itself

--no-dereference effect on the symbolic link itself

Select parameters:

--reference=< files or Directories >

--help

--version These two commands do not really want to fight every time. ............

4. Usage examples:

Example 1: Changing the group properties of a file

Command: Chgrp-v bin 001.log Change 001.log file from root group to bin Group

Example 2: Changing the group properties of a file according to a specified file

Command: chgrp--reference=001.log 002.log Change the file 002.log group properties, make the file 002.log properties and Reference files 001.log Group properties of the same

Example 3: Changing the group properties of the specified directory and all files under its subdirectories

Command: Chgrp-r bin test involves directories and subdirectories is the R parameter

Example 4: Changing file group properties by group ID

Command: Chgrp-r test

Group identification code to change the file group properties, 100 for the Users group identification code, specific groups and group identification code can go to/etc/group file to view

      

One Linux command per day (--CHGRP) command

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.