1.Linux Link Concept
There are two kinds of Linux links, one is called hard link (Hard link), the other is called Symbolic link (symbolic link). By default, the LN command produces a hard link.
"Hard Connection"
A hard connection refers to a connection through an index node. In a Linux file system, a file stored in a disk partition is assigned a number, called an index node number (Inode index), regardless of its type. In Linux, multiple file names point to the same index node. Generally this connection is a hard connection. The effect of a hard connection is to allow a file to have multiple valid pathname, so that users can build hard connections to important files to prevent "accidentally delete" functionality. The reason for this is as described above because there is more than one connection to the index node of the directory. Deleting only one connection does not affect the index node itself and other connections, and only when the last connection is deleted will the file's data block and directory connections be freed. That is, the condition that the file is actually deleted is that all of the hard connection files associated with it are deleted.
"Soft Connection"
Another connection, called a symbolic connection (symbolic link), is also called a soft connection. Soft link files have shortcuts similar to Windows. It's actually a special file. In a symbolic connection, a file is actually a text file that contains the location information for another file. 2. Deepen understanding through experiments
[oracle@linux]$ Touch F1 #创建一个测试文件f1
[oracle@linux]$ ln F1 f2 #创建f1的一个硬连接文件f2
[oracle@linux]$ Ln -S F1 f3 #创建f1的一个符号连接文件f3
[oracle@linux]$ ls-li #-I parameter displays the Inode node information of the file total
0
9797648-rw-r- -r--2 Oracle Oinstall 0 APR 08:11 F1
9797648-rw-r--r--2 Oracle oinstall 0 APR 08:11 f2 9797649 lrwxrwxr
WX 1 Oracle Oinstall 2 APR 08:11 f3-> F1
From the results above, it can be seen that the hard connection file F2 and the original file F1 the Inode node is the same, are 9797648, however, the inode node of the symbol connection file is different.
[oracle@linux]$ echo "I am F1 file" >>f1
[oracle@linux]$ cat F1
I am F1 file
[oracle@linux]$ cat F2
I am F1 file
[oracle@linux]$ cat F3
I am F1 file
[oracle@linux]$ rm-f F1
[oracle@linux]$ cat F2
I am F1 file
[oracle@linux]$ cat F3
cat:f3:No such file or directory
Through the above test can be seen: when the original file F1 deleted, hard connection F2 is not affected, but the symbolic connection F1 file is invalid 3. Summary
In this way you can do some related tests, you can get all the following conclusions:
1). Delete Symbol connection F3, have no influence to f1,f2;
2. Delete Hard connection F2, also have no influence to f1,f3;
3. Delete the original file F1, the hard connection F2 has no effect, resulting in symbolic connection F3 failure;
4. At the same time delete the original file F1, hard to connect F2, the entire file will be really deleted
Resources:
Http://www.cnblogs.com/itech/archive/2009/04/10/1433052.html