File attribute

Introduction

System Properties

The system attribute of the file is the system file, which will be hidden. In general, the system file cannot be viewed, and cannot be deleted. It is an operating system to protect attributes to important files to prevent these files from being accidentally damaged.

Hide Properties

When viewing the name of the disk file, the system generally does not display a file name with hidden properties. In general, files with hidden properties cannot be deleted, replicated, and renamed.

read-only attribute

For files with read-only properties, you can view its name, it can be applied, but can also be copied, but cannot be modified and deleted. If you set the executable to read-only files, it will not affect its normal execution, but you can avoid accidental deletions and modifications.

Archive Properties

After a file is created, the system will automatically set it to archive properties, which is often used for file backup.

Command Properties

There are two commands for file properties: lsattr (1) and chattr (1). You may guess that lsattr is used to "list" properties, and chattr is used to "change" them. Only directory and normal files can be given these properties. The following is an attribute that can be given:

No access time

If a file or directory is given this property, no matter which way it is read or written? It will not be updated last time. For example, this is very useful for files or directories that are often read accessed. Especially because this is the only parameter that the information node is only changed by read-only open.

can only attach

if a file has this attribute and is turned on in a written manner, the only action that may be performed on it is to increase data to previously deposited content. . For a directory, this means you can only increase the file and you cannot rename or delete the existing file. Only root can set or clear this property.

Non Dump

Dump (8) is a standard backup tool for UNIX®. It DUMP Any file system in any / etc / fstab (please refer to Chapter 8 File System and Mount Point). Unlike other properties, if a file or directory is given this property, it will not be processed during DUMP execution. Note For directory, this also includes all its subdirectory and files included.

Untroven

A file or directory that is given this property is completely unmodied: it cannot be renamed, pointing to it, it cannot be established [24] and it Can't be deleted. Only root can set or clear this property. Note that it will also prohibit changes to access times. Therefore, when I attribute is set, you don't have to set up A.

Secure Delete

When a file or directory with this property is deleted, the blocks occupied by this file or directory will be covered by 0.

Synchronous mode

All modifications to files or directories with such an attribute will be written immediately on the disk.

You may set I attributes to the basic system file to prevent malignant incidents. Also, look at the introduction of the A attribute in the man: This can reduce the operation of the disk, especially the battery power consumption of the laptop.

Command

Windows Under the DOS environment, you can use the command to change the file properties, such as attrib -a c: /1.txt is removed by the attribute A of the file 1.txt.

attrib [+ r | -r] [+ a | -a] [+ s | -s] [+ h | -h] [+ i | -i]

[Drive:] [PATH] [filename] [/ s [/ d] [/ l]]

+ setting properties.

- Clear properties.

r read-only file properties.

A archive file properties.

s system file properties.

h hides file properties.

i no content index file properties.

[Drive:] [PATH] [filename]

Specifies the file to be processed by Attrib.

/ s handles the matching files in the current folder and all subfolders.

/ d also processes the folder.

/ l The properties of the symbol link and the symbolic link target.

Related Articles
TOP