Use of Linux links: Create and delete symbolic connections

Source: Internet
Author: User
Use of Linux links: Create and delete symbolic connections

1. Usage: ln [Option] source_file dist_file
-F: When the file is created, the same file name will be deleted.
-I ask before deletion.
Ln-s abc cde establishes a soft connection of ABC
Ln abc cde establishes a hard connection to ABC,

2. Differences between soft links and hard links (common ):
A hard link can be considered as a file with two file names, while a soft link is
The system creates a link file pointing to the file

3. Differences between soft links and hard links (explanation ):

Linux soft connection and hard connection have a unique index contact for a file, but for an index contact number, multiple file names can correspond to it. Therefore, the same file on the disk can be accessed through different paths. Note that in Linux, everything is file. folders and newly added hard disks can all be processed by looking at the files.
A soft connection or a hard link is also called a symbolic link. Symbolic connection is equivalent to a shortcut in windows.
Hard connections to folders are not allowed. We usually use many soft connections.

Eg:
Ln-S source Dist # establish a soft connection
Ln source Dist # establish a hard connection

A soft link is actually just a piece of text that contains the name of the file it points to. The system automatically jumps to the corresponding file location after seeing the soft link. On the contrary, hard join opens a new directory item for the file. The hard link is equivalent to the original name of the file. in Linux, they are equivalent. For this reason, hard links cannot connect files on two different file systems.
(1) soft connections can span file systems, but hard Connections cannot. The practice is to use a shared file to connect the aa.txt text file in Windows to BB, CC. ln-s aa.txt/root/BB in the/root directory in Linux. Ln aa.txt/root/BB failed.
(2) I node issues. No matter how many hard connections direct to the same I node, the number of connections at the node increases. As long as the number of connections at the node is not 0, the file will always exist, whether you delete the source file or the connected file. As long as one exists, the file exists (in fact, no source file is connected, because they all point to the same I node ). When you modify the source file or the connection file, other files are synchronized. Soft links do not directly use the I node number as the file pointer, but use the file path name as the pointer. So
Deleting a connection file does not affect the source file. However, if you delete the source file, you cannot find the file to be directed. Soft links have their own inode, and there is a small space on the disk to store the path name.
(3) A soft connection can be used to connect a non-existent file name.
(4) soft connections can be used to connect directories.

Note: I node: it is a data structure used within UNIX to describe file features. we usually call I a file index node (information node ). the I node contains most important information about the file, including the address of the file data block on the disk. each I node has its own flag number, which is called the document sequence number. I node Information 1. file Type 2. file owner relationship 3. file Access permission 4. file time cut.



Delete the symbolic link.Rm-RF symbolic_name note not Rm-RF symbolic_name/

 

Linux soft connection and hard connection have a unique index contact for a file, but for an index contact number, multiple file names can correspond to it. Therefore, the same file on the disk can be accessed through different paths. Note that in Linux, everything is file. folders and newly added hard disks can all be processed by looking at the files.
A soft connection or a hard link is also called a symbolic link. Symbolic connection is equivalent to a shortcut in windows.
Hard connections to folders are not allowed. We usually use many soft connections.

Eg:
Ln-S source Dist # establish a soft connection
Ln source Dist # establish a hard connection

A soft link is actually just a piece of text that contains the name of the file it points to. The system automatically jumps to the corresponding file location after seeing the soft link. On the contrary, hard join opens a new directory item for the file. The hard link is equivalent to the original name of the file. in Linux, they are equivalent. For this reason, hard links cannot connect files on two different file systems.
(1) soft connections can span file systems, but hard Connections cannot. The practice is to use a shared file to connect the aa.txt text file in Windows to BB, CC. ln-s aa.txt/root/BB in the/root directory in Linux. Ln aa.txt/root/BB failed.
(2) I node issues. No matter how many hard connections direct to the same I node, the number of connections at the node increases. As long as the number of connections at the node is not 0, the file will always exist, whether you delete the source file or the connected file. As long as one exists, the file exists (in fact, no source file is connected, because they all point to the same I node ). When you modify the source file or the connection file, other files are synchronized. Soft links do not directly use the I node number as the file pointer, but use the file path name as the pointer. So
Deleting a connection file does not affect the source file. However, if you delete the source file, you cannot find the file to be directed. Soft links have their own inode, and there is a small space on the disk to store the path name.
(3) A soft connection can be used to connect a non-existent file name.
(4) soft connections can be used to connect directories.

Note: I node: it is a data structure used within UNIX to describe file features. we usually call I a file index node (information node ). the I node contains most important information about the file, including the address of the file data block on the disk. each I node has its own flag number, which is called the document sequence number. I node Information 1. file Type 2. file owner relationship 3. file Access permission 4. file time cut.



Delete the symbolic link.Rm-RF symbolic_name note not Rm-RF symbolic_name/

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.