Linux Soft links with hard links
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 F1 that is a soft link
[[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, but the inode of the symbolic connection file 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
This article is from the "Asteroid" blog, please be sure to keep this source http://3203180.blog.51cto.com/3193180/1876675
Chapter III Linux Soft links and hard links