[Linux learning stickers] zero-based learning record stickers-file permissions

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Add user: useradd username

Insert picture description here

Link file

The link file points to an actual target file, and its purpose is similar to the "shortcut" in the Windows system, that is, when accessing the link file, the actual access will be the target file pointed to by the link file.
Link files are divided into hard link files (hard link) and symbolic link files (symbolic link). The symbolic link only records the path where the target file is located, while the hard link file is actually a copy of the target file. You can use the ln command to create a hard link file or a symbolic link file about a certain target file.

ln command

[Function] Create a link file, and create a hard link file by default.
[Format]ln [Options] Source file path Link file path
[Main option] -b If there is a file with the same name, back up the original file before overwriting -s Create a symbolic link file
[Knowledge point] Both symbolic link file and hard link file What is the difference between? Why do I need to use two different link file types? These issues need to be discussed in conjunction with the concept of index nodes. ´ The index node is used to record the attribute information of files and directories (essentially files) and the physical location of the data blocks storing the files. You can use the -i option in the ls command to view the index number of each file. ´ Hard link file and symbolic link file. The key to the difference between them is that the hard link file and the target file share the same index node (inode), so even if the target file is renamed or moved to another directory, the hard link file is still valid . ´ The symbolic link file records the storage path of the target file, so when the target file is moved, the symbolic link will become invalid.
[You come knock it, try it]
Discover: the difference between a hard link file and a symbolic link file.
Step 1: Create a target file test and the corresponding hard link file hlink and symbolic link file slink. ´Step
2: Use the ls command to compare the differences in index numbers of these three files. ´Step
3: Change the name of the target file and check whether the two linked files are still valid. ´Step
4: Change the storage location of the target file and check whether the hard link file is still valid. ´Step
5: Modify the content of the target file. ´Step
6: Migrate the target file to the /boot directory and check whether the hard link file is still valid. (Hard links cannot be used to create file links between different file systems).

Guess you like

Origin blog.csdn.net/Shadownow/article/details/105474348