Cty's Linux study notes (5)

Linux Study Notes - Part 5

(Disclaimer: This note is only for study records and reference)

A Linux directory or file will have an owner and a group. The owner is the owner of the file, and the group refers to which group the file belongs to.

File properties:

d rwxr-xr-x 2 root root 6 2月 18 10:52 dic

1        2        3    4     5    6   7    8     9     10

1: Used to describe the file type:

    d: is the directory

    -: Indicates that the file is a normal file

    l: means as a link file

    b: It is a block device, such as /dev/sda, the disk partition file is this type

    c: Represented as serial port device file, such as keyboard, mouse, etc.

    s: represented as a socket file for communication between processes

2: The first 3 digits are owner permissions, the middle 3 digits are ownership permissions, and the last 3 digits are other user permissions (you must have x permissions to open and view the directory)

3: Occupied node: if it is a directory, the value is related to the number of subdirectories under the directory

4: File owner

5: The group to which the file belongs

6: file size

7, 8, 9: The last time the file was modified

10: filename


command:

chgrp(change group): Change the group to which files and directories belong, the format is chgrp[group name][file name]

groupadd: add a user group

chown(change owner): Change the left and right of the file, the format is "chown[-R] account file name" or "chown[-R] account name: group name file name" (-R cascade change)

useradd: add a user

chmod(change mode): Change the user's read, write and execute permissions on files/directories, format: chmod[-R] xyz file name (xyz is a number)

umask: used to change the default permissions of the file, format: umask xxx (3 x for numbers)

            (Note: To create a common file, there is no executable permission by default, only rw permission, 666)

            (Note: When creating a directory, all permissions can be opened by default, 777)

            The meaning of the umask value is the permissions that need to be subtracted from the default values ​​in the above two rules               

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325586870&siteId=291194637