linux file properties and permissions

In Linux system, there are three most common file permissions: read (R), write (W) and execute (X) permissions.

In Linux system, each file clearly defines the access rights of different identity users, which can be seen through ls command.

Example

➜ ls -l

As you can see, the first column of each line represents the permissions set by each file for different users, with 10 digits in total.

The first digit is used to represent the specific type of file, and the remaining 9 digits are used to set the read, write and execute permissions for different users.

File type

  • – : general documents
  • D: directory file
  • L: linked files
  • B: block device file, i.e. some interface devices that store data to provide random access to the system, such as hard disk, floppy disk, etc
  • C: character device files, i.e. interface devices of some serial ports, such as mouse, keyboard, etc
  • S: socket, data interface file, usually used for data transmission on the network
  • P: FIFO file

Different user explanations

Three file access identities are: user, user group, and others

linux permissions

Digital representation of file permissions

The location of the three permissions will not be changed. You can use numbers to represent each permission.

  • R = 4
  • W = 2
  • X = 1


The permissions of each identity are the sum of the three permissions.

Example

-rwxr-xr-x  1 ylspirit  staff  39 Nov  2 20:14 test1.awk

Owner permission is: 4 + 2 + 1 = 7
Group permission: 4 + 1 = 5
Other permission: 4 + 1 = 5
So the file permission is 755

More about Linux commands: Linux Commands Tutorial

Add a Comment

Your email address will not be published. Required fields are marked *