Easy understanding of Linux chgrp and chown commands

Source: Internet
Author: User

An operating system is essential to a computer. However, Linux is developing very rapidly and is catching up with Microsoft. Here we will introduce the knowledge of Linux, so that you can learn how to use Linux. Today I will talk about Linux chgrp and chown. I hope you will remember Linux chgrp and chown.

Chgrp command

Function: Change the group to which a file or directory belongs.

Syntax: chgrp [Option] group filename?

This command changes the user group to which the specified file belongs. The group can be either the user group ID or the group name of the user group in the/etc/group file. A file name is a list of files separated by spaces to change the group. Wildcards are supported. If the user is not the owner or super user of the file, the file group cannot be changed.

The options of this command are as follows:

-R recursively changes the group of all subdirectories and files in a specified directory.

Chown command

Function: Modify the owner and group of a file or directory. This command is also very common. For example, if the root user copies a file to xu, the root user should set the owner of the file to xu to allow xu to access the file. Otherwise, user xu cannot access this file.

Syntax: chown [Option] user or group file

Note: chown will change the owner of a specified file to a specified user or group. Users can be user names or user IDs. A group can be a group name or group ID. Files are separated by spaces to change the permission list. Wildcards are supported.

The options of this command are as follows:

-R recursively changes the owner of all subdirectories and files under a specified directory.

-V: displays the work done by the chown command.

I hope you can learn Linux chgrp and chown.

  1. Detailed introduction to the use of Linux scp
  2. Describe the concept of Linux Makefile
  3. Select your preferred Linux system Desktop
  4. Windows is worth the top ten features of Linux
  5. Use Linux to prevent hackers

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.