Ubuntu notes--Use of link ln: Create and delete Symbolic links

Source: Internet
Author: User

Original link: http://blog.csdn.net/janpylx/article/details/6761910

First, the mode of use

ln [option] source_file dist_file   (source_file is the file to be established for the linked file, Dist_file is the newly created link file)-F is established and will be deleted with the file name.-I ask before deleting. ln-s ABC CDE establishes the soft connection of the ABC, LN ABC CDE establishes the hard connection of ABC,

Second, the difference between soft link and hard link (popular)

1, hard link can be considered a file has two filenames, and soft link is the system to create a new link file, this file points to the file it refers to 2, soft links to files and folders, and hard links only for the file.

Third, the difference between soft link and hard link (explanation)

    For a file, there is a unique index point corresponding to it, and for an index contact number, you can have more than one file name corresponding to it. Therefore, the same file on the disk can access the file through a different path. Note that under Linux everything is file, folder, new HDD ... Can look at the file to deal with AH.    a soft connection (symbolic link) is also called a symbolic connection, connected with a soft connection and a hard link. Symbolic connections are equivalent to shortcuts under Windows. It    is not possible to make hard connections to folders, we usually use more soft connections.         eg:    ln-s source Dist        # Establishing a soft connection    ln Source Dist           # Establish a hard    -connect soft link is actually just a piece of text that contains the name of the file it points to, When the system sees the soft link, it automatically jumps to the corresponding file location for processing; instead, a hard join opens a new directory entry for the file, and the hard links are equal to the original names of the files, which appear to be equivalent in Linux. For this reason, a hard link cannot connect files on two different file systems.    (1) Soft connection can cross file system, hard connection is not possible. The practice is to use shared files to connect aa.txt text documents under Windows to Linux under the/root directory BB,CC. Ln-s Aa.txt/root/bb Connection succeeded. ln aa.txt/root/bb failed.    (2) questions about the I node. Hard connections No matter how many, all point to the same I node, will increase the number of node connections, as long as the junction number of connections is not 0, the file exists, regardless of whether you delete the source file or the connected file. As long as there is one exists, the file exists (in fact, it does not divide the source file connection files, because they point to the same I node). When you modify the source file or any one of the connection files, the other files will be changed synchronously. Soft links do not use the I node number directly as a file pointer, but instead use the file path masterpiece as a pointer. Therefore, deleting a connection file has no effect on the source file, but deleting the source file will cause the connection file to be unable to find the file to point to. The soft link has its own inode, and there is a small space on the disk to store the path name.    (3) A soft connection can be connected to a file name that does not exist.    (4) The soft connection can be connected to the directory.

Iv. Deleting links

Delete the symbolic link, there is the deletion rm-rf   symbolic_name   Note is not RM-RF   

Ubuntu notes--Use of link ln: Create and delete Symbolic links

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.