Discuss hard links and soft links

Source: Internet
Author: User


Summary of hard links and soft links 1 both hard links and soft links are definitions of hard links in www.2cto.com 2: Each file is referenced using its inode number, the file name is intended to improve user experience. Because of the separation of the file name and inode number (the file name is saved in the directory, rather than in the inode node), it is possible to direct multiple file names to the same inode number. All files must be hard-linked at least once and more than once. Features: 1) the link count is positively related to the number of connected files. When the link count decreases to 0, the file will be deleted. 2) the attached hard link is a regular file, only the inode Number of the host file is referenced. the other and the host file are generally no 2. www.2cto.com Syntax: ln file name. Note that the Link name cannot be used in advance: [plain] [root @ think water] # touch w [root @ think water] # cat & gt; w my name is think [root @ think water] # ll-I w 3496568-rw -r -- 1 root 17 09-25 w [root @ think water] # ln w w_hardlink [root @ think water] # ll-I total 8 www.2cto.com 3496568-rw -r -- 2 root 17 09-25 w 3496568-rw-r -- 2 root 17 09-25 w_hardlink [root @ think water] # cat w_hardlink my name is think restrictions: 1) because an inode number is shared, both files must be in the same file system. 2) You cannot create a hard link to the directory. 3. Soft link definition: the soft link reads the content of the object to which the object is directed. Features: 1) the soft link is a separate file different from the original file (the inode number is different) 2) the file type flag of Soft link is l 3) the permissions of the original file will control the access to the file, which is irrelevant to the permissions of Soft link 4) the soft link size is always equal to the total number of characters in the path name of the original File Syntax: www.2cto.com ln-s the original file soft link
Case: [plain] [root @ think water] # touch w [root @ think water] # cat> w my name is think [root @ think water] # ln-s w w_softlink [root @ think water] # ll-I total 4 3496568-rw-r -- 1 root 17 09-25 w 3496973 lrwxrwxrwx 1 root 1 09-25 w_softlink-> w [root @ think water] # cat w_softlink my name is think

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.