The difference and summary of Linux hard link and soft connection

Source: Internet
Author: User

Diagram of the difference between soft and hard links

Summary of Hard Links
    1. Multiple files with the same Inode node number are hard-linked files;
    2. Delete a hard-link file or delete any of the source files, the file entity is not deleted;
    3. The file entity is deleted only if the source file and all the corresponding hard link files are deleted;
    4. A hard-link file is another entry for a file;
    5. You can prevent important files from being mistakenly deleted by setting hard-link files to files.
    6. Create hard-Link command ln source file hard-link file;
    7. Hard-link files are ordinary files that can be deleted with RM;
    8. For a static file (no process is being called), the file is deleted when the number of hard links is 0 o'clock. Note: If a process is being called, it cannot be deleted or even if the file name is deleted but the space is not freed.
Summary of soft Links
    1. Soft links are like shortcuts to Windows systems;
    2. Soft links inside the source file is stored in the path, pointing to the source file;
    3. Delete the source file, the soft link still exists, but cannot access the content of the source file;
    4. When the soft link fails, it is usually flashing on white-light red background;
    5. Create soft Link command ln-s source file soft link file;
    6. Soft links and source files are different files, file types are different, inode numbers are also different;
    7. The file type of the soft link is "L" and can be deleted with RM.
The difference principle between hard and soft links is that hard links and source files have the same inode number, and they are hard links to each other. The Inode node number of the soft connection and source file is different, and the block is different, and the path name of the source file is stored in the soft connection block. In fact, hard links and source files are the same file, and soft connections are separate files, similar to shortcuts, where the source files are stored for easy pointing. With restrictions, you cannot create hard links to a directory, you cannot create hard links to different file systems, you cannot create hard links to nonexistent files, you can create soft connections to directories, you can create soft connections across file systems, and you can create soft connections to nonexistent files.

The difference and summary of Linux hard link and soft connection

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.