Linux is a multi-user, multi-tasking system. Many people often work on one machine at the same time. In order to protect everyone's privacy, the role of "file owner" is very important. When a Linux user logs in to the system, it carries a User ID (UID) and a User Group Identity (GID), which is equivalent to its own business card. When you need to access a file or program, you can know if you can read, write, or execute by swiping a business card. .
Enter ls -l in the root directory to see the following information:
Each record consists of 7 parts, with lrwxrwxrwx. 1 root root 7 Aug 18 21:27 bin -> usr/bin as an example. In order, the specific meanings are: |
Lrwxrwxrwx. stands for file type and permissions
1 represents the number of file connections
Root represents the owner
Root represents the user group
7 represents the file size (in K)
Aug 18 21:27 Representative document last modified time
Bin -> usr/bin filename
First, split the string of lrwxrwxrwx. The first character is used to describe the type of the file. The optional values ​​are:
– represents ordinary documents
d stands for directory
l indicates that this is a soft or hard connection
b represents a block device, such as a disk, that holds large blocks of data.
c stands for character devices, such as mice, keyboards, etc. that require continuous serial read and write
s stands for nested file (socket) file
p stands for named pipe file
This file l represents a soft or hard connection. The next 9 characters need three or three to look at:
Owner's authority
Permission of the group
Permissions of other users
The order is rwx, which corresponds to Read (Read), Write (Write), and eXcute (Execute). If there is no permission, use - to indicate.
The last one may be very confusing, what is used for it, query, the data shows that this point indicates the existence of "SELinux security label"! If selinux is turned off, this point will appear.
Also notice the last file name of the last demo, there is a -> representative soft connection or hard connection, then learn the difference between the soft connection and the hard connection.
A soft link (also known as a symbolic link, symlink or soft link) is a special type of file that contains a reference to other files or directories in the form of absolute or relative paths. A bit similar to the windows shortcut. The way to create it is: ln -s source dist
Hard-wired refers to the connection through an inode. In the Linux file system, files stored in a disk partition are assigned a number, called the Inode Index, regardless of the type. In Linux, multiple file names point to the same index node. Usually this connection is a hard connection. The role of hard links is to allow a file to have multiple valid path names so that users can establish hard links to important files to prevent "false deletions". The reason for this is as described above, because there are more than one connection to the index node corresponding to the directory. Deleting only one connection does not affect the inode itself and other connections. Only when the last connection is deleted will the file's data block and directory connection be released. In other words, the condition for the true deletion of a file is that all hard-wired files associated with it are deleted. The way to create it is: ln source dist
Through some combing, you can know some similarities and differences between soft and hard links:
It is not much different when used, it is equivalent to a file with a different path or file name
Enter the target file to delete the file connection, the soft connection will be invalid, the hard connection is only "connection number -1"
Soft links can be created anywhere, including the network, while hard links must be on the same disk
A detailed introduction to soft links and hard links will be introduced when sorting out inode-related knowledge points.
The next step is to modify the properties and permissions of the file. The first thing to learn is to modify the user or user group. Command format: chown [-R] username:group filename (where -R is used when modifying the folder, which means recursive modification.)
There are two ways to modify read and write permissions:
1, the digital method
The permission rwx corresponds to 4, 2, 1, which can be understood as a 3-digit binary. If the read permission is 4, if the user has read and write permissions, then 4+2=6, and so on.
The chmod 700 filename performs the setting of the user's permission to read and write. The user group and other users do not have permission.
2, text method
The grammar method first introduces four letters: u, g, o, a, where u stands for user, g stands for group, o stands for other, and a stands for all. In addition, you need to learn three symbols: +, -, =, which represent add, subtract, and set, such as: chmod ug+w filename , which means to add write permission to the user and user group of filename.
to add on:
1. Hide the file
The initial ls -l does not display all the files in the directory. You can use ls -al to display all the information:
You can see that there are a lot of files in front of the root home directory. These files are hidden files in Linux. In Linux, you can hide the file by adding one to the file name.
2, special catalog
There are several special directories under Linux: ".", "..", "-", "~"
"." Current directory
".." upper directory
"-" previous working directory
"~" current user's home directory
3, special file permissions
In addition to rwx, Linux files have two special permissions, s and t. Usually not used much, do not do in-depth study.
Small computer system interface (SCSI) is an independent processor standard for system level interfaces between computers and intelligent devices (hard disks, floppy drives, optical drives, printers, scanners, etc.). SCSI is an intelligent universal interface standard.
Small computer system interface (SCSI) is an independent processor standard used for system level interface between computer and intelligent devices (hard disk, floppy drive, optical drive, printer, scanner, etc.). SCSI is an intelligent universal interface standard
SDR+V.26 SCSI Section
ShenZhen Antenk Electronics Co,Ltd , https://www.pcbsocket.com