12, Linux soft links and hard links in the detailed

Source: Internet
Author: User
Tags joins

      • Soft joins and hard-link plots

      • Hard Links

      • Symbolic Links

      • Soft links and Hard links


Soft links and Hard links

The link file under Linux is a bit like a shortcut to Windows, but it's not exactly the same. There are two types of linked files: One is a hard link and the other is a symbolic link (also known as a soft link).

The Unix file system provides a mechanism for linking different files to the same file, which we call a link. It allows a single program to use a different name for the same file. The benefit is that the file system only has a copy of the file, and the system simply implements the connection by creating a new entry in the directory.

Soft joins and hard-link plots

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/86/D6/wKioL1fM4ingnT0zAAA8aKAQ89M007.png "title=" Qq20160905030801.png "alt=" Wkiol1fm4ingnt0zaaa8akaq89m007.png "/>

Hard Links

A hard link can be created by the command link or ln, such as:

link
ln oldfile newfile
Symbolic Links

Soft link (also called symbolic link) It is a special file that points to another file whose data part contains only the pathname of the file to which it is linked. Soft links are introduced to overcome the lack of hard links, and soft links do not directly use the Inode number as a file pointer, but instead use the file path name as a pointer (soft link: file name + data part ‐‐> The pathname of the destination file). The software has its own inode and has a small space on the disk to store the path name. Therefore, the soft link can cross the file system, can also be linked with the directory; Second, a soft link can link to a nonexistent file name, but it will not open its link until it has been created. When a soft link points to a file that has been renamed or moved, the soft link does not update, and the original value remains unchanged.

For example, a file system has run out of space, but now you have to create a new directory under the file system and store a large number of files, you can link another file system with more remaining space in the file system, which can be a good solution to the problem of space shortage. Deleting a soft link does not affect the file being pointed to, but if the original file being pointed to is deleted, the associated soft connection becomes a dead link.

ln -s old.file soft.link
ln -s old.dir soft.link.dir


This article from "Live by the Sea like Waves" blog, please be sure to keep this source http://zhang789.blog.51cto.com/11045979/1846353

12, Linux soft links and hard links in the detailed

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.