Linux Command--ln command

Source: Internet
Author: User

The ln command is a synchronous link for a file, and LN has two types of soft connections and one for hard links. A hard link means that a file can have multiple names, whereas a soft link creates a special file with the content of the file pointing to the location of another file. Hard links exist in the same file system, but soft links can span different file systems. A soft connection is similar to a shortcut to the current file, does not occupy space, a hard link is a copy of the current file, the size is the same as the source file, the changes are synchronized.

Here are a few to note that hard links do not work on the folder, the other hard links can not boast the file system.

Example 1

ln a.txt atxtlinkln-s a.txt atxtlinklnsyn-rw-r--r--2 xxx users 06-18 22:31 a.txt-rw-r--r--2 XXX Users 06-18 22:31 atxtlinklrwxrwxrwx 1 xxx users 5 08-19 21:17 Atxtlinklnsyn-a.txt

When the source file is deleted, the hard-link file is still in, the soft-connected file is not open

-rw-r--r--1 xxx users 06-18 22:31 atxtlinklrwxrwxrwx 1 xxx users 5 08-19 21:17 Atxtlinklnsyn-> ; A.txt

After rebuilding the source file, the soft link is not flashing prompt, indicating that the link file system has been linked successfully, after rebuilding, the hard link file is not affected by the source file, the contents of the hard-linked file or the content of the source file before the deletion, indicating that the hard link is invalid

Example 2 to create a soft connection to a folder, where-V indicates that the details are displayed, the directory creation link must be in absolute path, relative path creation will not succeed, will prompt: The number of layers of the symbolic connection too many errors

Ln-vs Test/testlink

Reference documents

Http://www.cnblogs.com/peida/archive/2012/12/11/2812294.html


Linux Command--ln command

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.