Simple to understand, Soft connect : Create a soft Connection file is a shortcut to the source file, delete the created soft connection file, the source file is unaffected, the connection disappears.
Hard link : Two conjoined files, modify one of the files, the other file will also change, delete one of the files, the other file has no effect, but the connection disappears.
Deepen understanding through experimentation
[Email protected]]$ Touch F1 #创建一个测试文件f1
[Email protected]]$ LN F1 F2 #创建f1的一个硬连接文件f2
[Email protected]]$ ln-s F1 F3 #创建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, all 9797648, however, the inode node of the symbolic connection file is 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
Deepen understanding through experimentation
[Email protected]]$ Touch F1 #创建一个测试文件f1
[Email protected]]$ LN F1 F2 #创建f1的一个硬连接文件f2
[Email protected]]$ ln-s F1 F3 #创建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, all 9797648, however, the inode node of the symbolic connection file is 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
Linux System Learning ln (soft connections and hard links)