What is a file link in Linux?

Source: Internet
Author: User
What is a file link in a Linux system-Linux general technology-Linux technology and application information, the following is a detailed description. There are two types of links: Hard Link and Symbolic Link ). By default, the ln command generates a hard link.

Hard connection refers to the connection through the index node. In a Linux File System, a file stored in a disk partition is assigned with an Index node number (Inode Index) No matter what type it is ). In Linux, multiple file names direct to the same index node. Generally, this type of connection is hard connection. A hard connection allows a file to have multiple valid path names. In this way, you can create a hard connection to an important file to prevent "accidental deletion. The reason is as described above, because there is more than one connection to the index node of the directory. Deleting only one connection does not affect the connection between the index node and other nodes. Only when the last connection is deleted will the connection of the data block and directory of the file be released. That is to say, the object will be deleted.

In contrast to hard connection, there is another connection in the Lnux system, called Symbilc Link. Soft-link files are similar to Windows shortcuts. It is actually a type of special file. In a symbolic connection, a file is actually a text file containing the location information of another file.

Touch f1 (create an f1 file)
Ln f1 f2 creates a hard connection of f2
Ln-s f1 f3 creates an f3 soft connection

In this case, if f3 is deleted, f1 and f2 are not affected. If f2 is deleted, f1 and f3 are not affected. If f1 is deleted, f1 is also applied to f2, so it does not affect the f2 node. The file created by touch still exists, but f3 becomes invalid because it is a soft connection. If f1 and f2 are deleted, the touch startup files will be deleted.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.