Linux: symbolic links and hard links

Source: Internet
Author: User
Tags linux shell commands
Linux: Symbolic Link and hard link-general Linux technology-Linux technology and application information. For more information, see the following. Today, we will start to "Review" Linux shell commands. You can see the following section:

Hard link file. Hard links cannot be made to directory files, and hard links cannot be made between different file systems. Ln [source file name] [target file name] example: mv/etc/rc. d/rc3.d/K50xinetd/etc/rc. d/rc3.d/S50xinetd soft link file. That is, the symbolic link. You can use this method to create files. Ln-s [source file or folder name] [target name]

The link file is a simple shortcut .. However, I don't understand the ln command, and Baidu later found the following materials:

Hard links can only reference files in the same file system. It references the physical index (inode) of the file in the file system ). When you move or delete the original file, the hard link will not be broken because it references the physical data of the file rather than the position of the file in the file structure. A hard-linked file does not require the user to have the permission to access the original file or display the location of the original file. If the deleted file has a hard link, the file will still be retained until all references to it are deleted. (Each time you add a hard link counter + 1, find a hard link, counter-1, when the counter is 0, the file will be deleted)

There are also soft links (or symbolic links ):

A symbolic link is a pointer pointing to the position of a file in the file system. Symbolic Links can point to files in a remote file system across file systems. The symbolic link only specifies the location of the original file. You must have access to the location of the original file to use the link. If the original file is deleted, all symbolic links pointing to it will be damaged. They point to a location that does not exist in the file system. (Deleting a symbolic link does not delete the original file)

I learned a little more. In a few days, you will be visiting Linux.
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.