The difference between Linux soft and hard links

Source: Internet
Author: User

Summary of Hard Links

Multiple files with the same Inode node number are hard-linked files;
Delete a hard-link file or delete any of the source files, the file entity is not deleted;
The file entity is deleted only if the source file and all the corresponding hard link files are deleted;
A hard-link file is another entry for a file;
You can prevent important files from being mistakenly deleted by setting hard-link files to files.
Create hard-Link command ln source file hard-link file;
Hard-link files are ordinary files that can be deleted with RM;
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

Soft links are like shortcuts to Windows systems;
Soft links inside the source file is stored in the path, pointing to the source file;
Delete the source file, the soft link still exists, but cannot access the content of the source file;
When the soft link fails, it is usually flashing on white-light red background;
Create soft Link command ln-s source file soft link file;
Soft links and source files are different files, file types are different, inode numbers are also different;
The file type of the soft link is "L" and can be deleted with RM.

The difference between hard links and soft links

1) on the principle, the hard link and the source file inode node number is the same, the two 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.
2) In fact, hard links and source files are the same file, and the soft connection is a separate file, similar to a shortcut, the location of the source files stored information for easy pointing.
3) on the usage limit, you cannot create hard links to the 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 between Linux soft and hard links

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.