1.Linux link concept : There are two types of Linux links, one called hard links, and the other called Symbolic links (symboliclink). By default, theln command produces a hard link.
"hard Connect" hard join means connecting through an index node. In linux in the file system, Files saved in a disk partition regardless of what type it is assigned a number, called the cable PIN node number linux " delete by mistake "
"Soft Connect"
Another connection is called a symbolic connection (symbolic link), also known as a soft connection. A soft-link file has a shortcut similar to Windows . It's actually a special file. In a symbolic connection, a file is actually a text file that contains location information for another file.
2. deepen understanding through experimentation
[[Email protected]]$ Touch F1 # Create a test file F1
[[Email protected]]$ LN F1 F2 # create A hard connection file for F1 F2
[[Email protected]]$ ln-s F1 F3 # create A symbolic connection file for F1 f3
[[Email protected]]$ ls-li #-I parameter displays inode node information for a 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 lrwxrwxrwx 1 Oracle oinstall 2 APR 08:11 f3-F1
As can be seen from the above results, the hard connection file F2 the same as the inode node of the original file F1 , both 9797648 , however, the symbolic connection file Inode nodes are different.
[email protected]]$ echo "I am F1 file" >>f1
[email protected]]$ cat F1
I am F1 file
[email protected]]$ cat F2
I am F1 file
[Email protected]]$ cat F3
I am F1 file
[email protected]]$ rm-f F1
[email protected]]$ cat F2
I am F1 file
[Email protected]]$ cat F3
cat:f3:No such file or directory
As you can see from the above test , hard connection F2 is not affected when the original file F1 is deleted, but the symbolic connection F1 file is not valid
3. Summary
in this way you can do some related tests and get all the following conclusions:
1). To Delete a symbolic connection F3, the F1,f2 no impact;
2). remove a hard connection F2 , the f1,f3 have no effect;
3). Delete original file F1 , for hard connections F2 no impact, resulting in symbolic connections f3 failure;
4). Delete the original file at the same time F1, Hard Connect F2 , the entire file will actually be deleted.
This article is from the "one Gourd soy sauce" blog, please be sure to keep this source http://zhushenghang.blog.51cto.com/11105203/1825726
Linux operating systems-soft connections and hard links