In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what is the difference between Linux chattr command and chgrp command", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "What is the difference between Linux chattr command and chgrp command"!
Linux chattr command
The Linux chattr command is used to change file attributes.
This command changes file or directory attributes stored on the ext2 file system in eight modes:
a: Make the file or directory available for additional purposes only.
b: *** access time for files or directories is not updated.
c: Compressed files or directories for storage.
d: Excludes files or directories from dumping operations.
i: No arbitrary alteration of files or directories.
s: Confidentiality Delete files or directories.
S: Update files or directories instantly.
u: Deletion except prevention.
syntax
chattr [-RV][-v][+/-/=][File or directory...]
parameters
-R Recursive processing, all files and subdirectories under the specified directory are processed together.
-v Sets the file or directory version.
-V shows the execution of the command.
+ Turn on this attribute of the file or directory.
- Closes this attribute for a file or directory.
= Specifies the attribute of the item for the file or directory.
examples
Use chattr to prevent a key file from being modified:
chattr +i /etc/resolv.conf
lsattr /etc/resolv.conf
The following properties are displayed
----i-------- /etc/resolv.conf
Let a file can only add data to it, but cannot delete it. It applies to various log files:
chattr +a /var/log/messages
Linux chgrp command
The Linux chgrp command is used to change the group to which a file or directory belongs.
In the UNIX family, control of file or directory permissions is managed by owner and group. You can use chgrp to change the group to which files and directories belong, either by group name or group ID.
syntax
parameter description
-c or--changes works like the "-v" parameter, but only returns the part that changed.
-f or--quiet or--silent No error messages are displayed.
-h or--no-dereference Modifies only the symbolically linked document and does not alter any other related document.
-R or--recursive Recursive processing, all files and subdirectories under the specified directory are processed together.
-v or--verbose shows instruction execution.
--help Online help.
--reference= Sets all of the groups to which the specified file or directory belongs to the same group as the reference file or directory.
--version Displays version information.
examples
Example 1: Changing the group properties of a file:
chgrp -v bin log2012.log
Output:
"log2012.log" belongs to group changed to bin
Note: Change log2012.log file from root group to bin group
Example 2: Changing group attributes of files according to specified files
chgrp --reference=log2012.log log2013.log
Output:
Description: Change the group attributes of the file log2013.log so that the group attributes of the file log2013.log are the same as the group attributes of the reference file log2012.log
At this point, I believe that we have a deeper understanding of "Linux chattr command and chgrp command what is the difference", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.