Linux disk and file system management (6) _ link file ln

Source: Internet
Author: User

Linux disk and file system management (6) _ link file ln
File: hard link: multiple paths point to the same inode. When multiple paths point to one inode, when a hard link is created, the reference count of inode is increased. When a hard link is deleted, only one access path is deleted, the file still exists, and inode and block still exist, the file cannot be found only when the last path is deleted. Note: hard links cannot be used for directories. Hard links cannot be used for symbolic link symbolic links across partitions. This is equivalent to using a shortcut to direct the data of a file to another file path. Point to another file path, instead of inode. The reference count is not added for creating a symbolic link to the file. Deleting the original file will make the symbolic link file unusable. Note: the symbolic link can be used for directories. the symbolic link can be used for cross-partition operations. The ln command creates the link ln [-sf] source file destination file-s: symbolic link-v: verbose displays details-f: if the target file exists, the target file is deleted and then ln is created. By default, a hard link is created. Example:

# Create a hard link [root @ localhost ~] # Ln/etc/fstab/tmp/test/ln_test # view its file attributes. The file attributes are the same, and the reference link count is changed to 2 [root @ localhost ~] # Ll/etc/fstab/tmp/test/ln_test-rw-r --. 2 root 783 Sep 1509:52/etc/fstab-rw-r --. 2 root 783 Sep 15/tmp/test/ln_test # create a symbolic link [root @ localhost ~] # Ln-s/etc/fstab/tmp/test/ln_test_symbolic # file attributes [root @ localhost ~] # Ll/etc/fstab/tmp/test/ln_test_symbolic-rw-r -- r --. 2 root 783 Sep 1509:52/etc/fstablrwxrwxrwx. 1 root 10 Sep 15 21:14/tmp/test/ln_test_symbolic->/etc/fstab

 


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.