An unfamiliar Linux command every day (1)

Source: Internet
Author: User
What is this order for?

In a nutshell, change the group of files and directories with CHGRP. CHGRP is the abbreviation for Change group. The changed group name must be in the/etc/group file, which means that the group name must already exist.

1. Command format:
chgrp [parameters] [group] [file]

2. Permission to use:
The usage permission is superuser.

3. Command parameters:

Common parameters:
-R handles all files in the specified directory and its subdirectories
-V Show Change results
--reference=< file or directory >**

4. Usage examples:
Example 1: Changing the group properties of a file
Command:
chgrp -v chuji001 niu2.py

Description
Change the niu2.py file from the root group to the CHUJI001 group, where the-V is used, and you can see whether the result is successful or not.

Example 2: Changing the group properties of a file according to a specified file
Command:
chgrp --reference=niu2.py niu3.txt

Description
Change the group properties of the file Niu3.txt, so that its group properties and file niu2.py Group properties are the same, here --reference=[file or folder] This command, usually work can be used.

Example 3: Changing the group properties of the specified directory and all files under its subdirectories
Command:
chgrp -R chuji001 fuck1

Description
Changes the group properties of all files in the specified directory and its subdirectories, where-R is used, recursively processing all files and subdirectories.

3 parameters, 3 instances, master these 3 parameters, chgrp This command is almost there, and some of the other parameters are rarely used in the work.

An unfamiliar Linux command every day (1)

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.