In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to modify and view file properties in the Linux system. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Chattr
Chattr modifies the unique properties of files on the Linux second extended file system (E2fs)
There are several formats of symbol patterns: +-= [ASacdisu].
The operator `+'is used to add selected attributes to the existing attributes of the file;` -'is used to remove the selected attributes on the file; and `='is used to specify the unique attributes of the file.
The character `ASacdisu' is used as an option for new file attributes: do not update atime (A), synchronously update (S), only add (a), compress (c), immutable (I), non-transferable (d), delete protection (s) and undeletable (u).
-R
Recursively modify the properties of the directory and its contents. If a symbolic link is encountered in a recursive directory, traversal will be skipped.
-V
Give the output information of chattr in detail and print out the version of the program.
-vversion
Set the version of the file system.
When you modify a file with the'A 'property set, its atime record does not change. This can avoid some disk I / O processing in notebook systems.
Files with the `a' attribute set can only be opened for writing in add mode. Only superusers can set or clear this property.
Files with the `c' attribute set are automatically compressed by the kernel on disk. Uncompressed data is returned when reading from this file. A write to the file will compress the data before saving them to disk.
Files with the `d' attribute cannot be backed up by running the dump (8) program.
A file with the `i' attribute set cannot be modified: you can neither delete it nor rename it, you can't create a link to the file, and you can't write any data to it. Only superusers can set or clear this property.
When you delete a file with the `s' attribute set, its data blocks are cleared and written back to disk.
When you modify a file with the `S' attribute set, the modification is synchronously written to disk, which has the same effect as the `Smount option applied to the file subsystem.
When you delete a file with the `u' attribute set, its contents will be saved. This allows the user to request recovery of deleted files.
Example:
The code is as follows:
[root@localhost ~] # chattr + I nginx.conf # setting this file cannot be modified in any situation
[root@localhost ~] # mv nginx.conf nginx.conf_bak
Mv: cannot move "nginx.conf" to "nginx.conf_bak": disallowed operation
[root@localhost ~] # lsattr nginx.conf # View the permissions set by chattr
-iMure-nginx.conf
[root@localhost ~] # chattr-I nginx.conf # cancel the permission setting of-I
[root@localhost ~] # lsattr nginx.conf # View the permissions set by chattr
-e-nginx.conf
Lsattr
Lsattr displays the unique properties of files on the second extended file system of Linux
-R
Recursively lists the properties of the directory and its contents.
-V
Displays the version of the program.
-a
List all files in the directory, including'.' The properties of the beginning file.
-d
List the attributes of the directory as other files, rather than the contents below it.
-v
Displays the file version.
Example:
The code is as follows:
[root@localhost ~] # chattr + I nginx.conf # setting this file cannot be modified in any situation
[root@localhost ~] # mv nginx.conf nginx.conf_bak
Mv: cannot move "nginx.conf" to "nginx.conf_bak": disallowed operation
[root@localhost ~] # lsattr nginx.conf # View the permissions set by chattr
-iMure-nginx.conf
[root@localhost ~] # chattr-I nginx.conf # cancel the permission setting of-I
[root@localhost ~] # lsattr nginx.conf # View the permissions set by chattr
-e-nginx.conf
On how to modify and view file properties in the Linux system is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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: 204
*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.