View linux file attributes

The first character in Linux means that the file is a directory, file or link file, etc.:

  • When it is [d ], it is the directory
  • When it is [-], it is a file;
  • If it is [l ], it means link file (link file);
  • If it is [b], it means the interface device (device with random access) available for storage in the device file;
  • If it is [c ] , it means the serial port device in the device file, such as keyboard and mouse (one-time reading device).

In the following characters, three are a group, and they are all combinations of the three parameters of "rwx" .

  • [r] stands for read (read)
  • [w] stands for write
  • [x] stands for execute.

It should be noted that the position of these three permissions will not change. If there is no permission, a minus sign [-] will appear.
The attributes of each file are determined by the 10 characters in the first part on the left, and the numbers 0-9 from left to right are used to indicate.
Insert picture description here
Bit 0 determines the file type
. Bits 1-3 determine the owner (the owner of the file) to have the permissions of the file.
Bits 4-6 determine the belonging group (users in the same group as the owner) to have permission for the file.
Bits 7-9 determine that other users have the permissions of the file.

  • Bits 1, 4, and 7 indicate the read permission. If it is indicated by the "r" character, it has read permission; if it is indicated by the "-" character, it has no read permission;
  • The second, fifth, and eighth digits indicate the write permission. If it is expressed by the "w" character, it has the write permission, and if it is expressed by the "-" character it has no write permission;
  • The 3rd, 6th, and 9th digits indicate the executable authority. If it is indicated by the "x" character, it has the execution authority; if it is indicated by the "-" character, it has no execution authority.

Guess you like

Origin blog.csdn.net/weixin_44635198/article/details/113180914