The difference between hard links and soft links in Linux

Source: Internet
Author: User

In a Linux system, the kernel allocates an Inode (index node) for each newly created file, each with a unique inode number. The file attributes are stored in the index node, and the index nodes are copied to the file when they are accessed, enabling quick access to the file.

A link is a way to establish a connection between a shared file and a number of directory entries for the user who accesses it.

Two types of links:

1. Hard link

2. Soft link (Soft link) or symbolic link (symbolic link) is equivalent to a shortcut under Windows

*********************************************************************************

Ln-s Source Dist # establishing a soft connection

ln Source Dist # to establish a hard connection

*********************************************************************************

1. Soft link is actually just a paragraph of text, pointing to the original file path information , can be any file or directory , can link different file system files

even , which produces a "broken chain" problem (or "phenomenon")!

2. When the symbol file is read or write operation, the system will automatically convert the Operation to the source file, but when deleting the linked file , the system simply deletes the linked file, not the source file itself.

Use the Ln-s command to generate a soft connection, as follows:

[[email  protected] test]# ln-s  source_file softlink_file

*********************************************************************************

A hard connection takes up the same amount of space and changes one of the two, and the same change happens to the other.

1. Hard connections must be in the same file system , and soft connections can cross file systems

2. do not allow the creation of hard links to the directory


This article is from the Linux Operations sharing blog, so be sure to keep this source http://liangey.blog.51cto.com/9097868/1572184

The difference between hard links and soft links in Linux

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.