Preface:
In my previous blog (), I explained the naming rules, directory structure, file management, permission management, and file search of files, the most visible is the content of the following two images.
Figure 1: linux File Attributes
Figure 2: linux Default Permissions
In Figure 1, we can see that the figure is divided into seven columns, each column represents what I will describe in detail below. In Figure 2, we can see the default permissions for the test1 file and the test2 directory file, what does that mean? Well, I don't want to talk about nonsense. Let's talk about it in detail.
1. default file attributes
In Figure 1, we can see that the default attributes of a file are divided into seven columns, and their meanings are as follows:
Column 1: indicates the file type and permission (permission)
File Type:
-: Common file (f)
D: directory file
B: block Device Files)
C: character device file (character)
L: symbolic link file)
P: Command pipeline file (pipe)
S: socket File)
File Permission: 9 bits, each 3 bits, each group: rwx (read, write, execute), r --
The first group is the permissions of the file owner. The owner of the file can read and write but cannot execute it;
Group 2: Same Group Permissions
Group 3: Other permissions not in this group
Column 2: Number of hard links to a file (I will describe it in detail during disk management)
Column 3: owner of the file or directory)
Column 4: indicates the group to which the file belongs)
Column 5: size of the file. The default unit is bytes.
Column 6: file creation date or latest modification date
Access: access
Modify: modify. The file content has changed.
Change: change, metadata, metadata
Column 7: file name of this file
2. Default permissions for files and directories
From the above explanation, we can see that a file has several attributes, including basic permissions such as read/write operations (r, w, x) and whether it is a directory (d) file (-) and other attributes! The method for modifying attributes is also discussed in my previous blog (chgrp, chown, chmod ). Now we know how to create or change the attributes of a directory or file. However, do you know what the default permissions will be when you create a new file or directory? Hey! It's related to umask! So what is umask doing? Basically, umask specifies the default permissions of the current user when creating a file or directory. How do I know or configure umask?