Use of Linux links create and delete symbolic connections __linux

Source: Internet
Author: User
1. How to use: ln [option] source_file Dist_file
When-F is established, it is deleted with the file name.
-I to ask before deleting.
LN-S ABC CDE establishes the soft connection of ABC
The LN ABC CDE establishes the hard connections of ABC,

2. The difference between soft link and hard link (popular):
A hard link can be thought of as a file with two filenames, and a soft link is
The system creates a new linked file that points to the file to which it refers

3. The difference between soft link and hard link (explanation):
Linux Soft connection and hard connectionFor a file, there is a unique index point corresponding to it, and for an index contact number, but can have more than one file name corresponding to it. Therefore, the same file on disk can access the file through a different path. Note that under Linux is everything file Ah, folder, the new hard disk ... Can look at the file to deal with AH.
The connection has the soft connection and the hard connection (hard link) 's cent, the soft connection (symbolic link) is also called the symbolic connection. Symbolic connections are equivalent to shortcuts under Windows.
You can not establish a hard connection to the folder, we usually use or soft connection more.

eg
Ln-s Source Dist # Establish a soft connection
LN Source Dist # Establish a hard connection


Soft links are actually just a piece of text, it contains the name of the file it points to, the system sees the soft link and automatically jumps to the corresponding file location for processing; instead, hard joins open a new directory entry for the file, and the hard link is equal to the original name of the file, which seems to be equivalent to Linux. For this reason, hard links cannot connect to files on two different file systems.
(1) Soft connection can cross file system, hard connection is not possible. The practice approach is to use shared files to connect Windows Aa.txt text documents to the Linux/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 connection no matter how many, are pointing to the same I node, will connect the number of nodes increased, as long as the connection number of nodes is not 0, the file will always exist, whether you delete the source file or connected files. As long as there is one existence, the file exists (in fact, no source files are connected to the file, because they point to all the same I node). When you modify the source file or connect to any one of the files, the other files will be synchronized changes. Soft links do not use the I node number directly as a file pointer, but instead use file path masterpieces as pointers. So deleting a connection file has no effect on the source file, but if you delete the source file, the connection file will not find the file you want to point to. Soft links have their own inode, and there is a small piece of space on the disk to store the path name.
(3) A soft connection can connect to a nonexistent file name.
(4) Soft connection can be connected to the directory.

Note: I node: it is a data structure inside UNIX that describes the characteristics of a file. We usually call the I node the file index node (information node). The I node contains most of the important information about the file, including the address of the file 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 rights for files 4. The time cut of the file.



finally delete the symbolic link and have it created there will be deleted RM-RF symbolic_name attention is not RM-RF symbolic_name/

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.