Use of Linux links to create and delete symbolic connections

Source: Internet
Author: User

1. usage : When ln [option] source_file dist_file-f is established, it will be deleted with the file name.                     -I ask before deleting. LN-S ABC CDE establishes the soft connection of ABC, LN ABC CDE establishes the hard connection of ABC,
2. The difference between soft links and hard links (popular): Hard links can be considered as a file with two filenames, whereas a soft link is a system that creates a new linked file pointing to the file it refers to
3. The difference between soft links and hard links (explained):

Linux soft and hard connections for a file, there is a unique index point corresponding to it, and for an index contact number, you can have multiple filenames 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 # Establish a soft connection ln Source Dist # Establish a hard connection
Soft link is actually just a piece of text, which contains the name of the file it points to, the system sees the soft link 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 and the original names of the files are equal, and in Linux it appears to be equivalent. 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.
Note: I node: it is a data structure used internally by UNIX to describe the characteristics of a file. We usually call the I node the file index node (information node). The I node contains important information about most of the file, including the address of the file data block on disk. Each I node has its own flag number, which we call the file sequence number. I node contains information 1. file type 2. File is the main relationship 3. Access to files 4. The time of the file is truncated. finally delete the symbolic link, there is the deletion of the creation RM-RF symbolic_name Note not rm-rf symbolic_name/

Use of Linux links to create and delete symbolic connections

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.