Article Title: Linux link file type. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
There are two types of Linux linked files, which are similar to shortcuts in windows. However, the Linux link file type is different from that in windows.
One of the most important features of a Linux file system is its file link. The link is a reference to the file, so that you can see the file in the file system. However, in Linux, links can be treated as original files. Links can be executed, edited, and accessed like normal files. For other applications in the system, the link is the original file corresponding to it. When you edit a file through a link, you actually edit the original file. The link is not a copy. There are two types of links: hard link and symbolic link (soft link ).
Hard Link
Hard links can only reference files in the same file system. It references the physical indexes (also known as inode) of files in the file system ). When you move or delete the original file, the hard link will not be broken because it references the physical data of the file rather than the position of the file in the file structure. A hard-linked file does not require the user to have the permission to access the original file or display the location of the original file. This helps the file security. If the deleted file has a hard link, the file will still be retained until all references to it are deleted.
Symbolic Link (soft link)
A soft link is a pointer pointing to the position of a file in the file system. Symbolic Links can point to files in a remote file system across file systems. The symbolic link only specifies the location of the original file. You must have access to the location of the original file to use the link. If the original file is deleted, all symbolic links pointing to it will be damaged. They point to a location that does not exist in the file system.
Both links can be created using the ln command. By default, ln creates hard links. You can use the-s switch to create a symbolic link.