Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use chgrp and chown commands in Linux

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use the chgrp and chown commands in Linux. It is very detailed and has a certain reference value. Friends who are interested must finish it!

Chgrp command

Function: change the group to which the file or directory belongs.

Syntax: chgrp [option] group filename?

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

The options of this command mean:

-R recursively changes the grouping of the specified directory and all subdirectories and files under it.

Chown command

Function: change the owner and group of a file or directory. This command is also very common. For example, the root user copies one of his files to the user xu. In order to enable the user xu to access the file, the root user should set the owner of the file to xu, otherwise, the user xu cannot access the file.

Syntax: chown [options] user or group files

Description: chown changes the owner of the specified file to the specified user or group. The user can be a user name or user ID. A group can be a group name or a group ID. Files are a list of files to change permissions separated by spaces, and wildcards are supported.

The options for this command mean the following:

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

-v shows the work done by the chown command.

The above is all the contents of the article "how to use chgrp and chown commands in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report