Hard Link
[Oracle @ DCM ~] $ Ln original. File hard. Link
Soft link
[Oracle @ DCM ~] $ Ln-SOriginal. File soft. Link
[Oracle @ DCM ~] $ LS-l
-RW-r -- 2 Oracle oinstall 4 Jul 14 17:21 Original. File
-RW-r -- 2 Oracle oinstall 4 Jul 14 :21 hard. Link
Lrwxrwxrwx 1 Oracle oinstall 13 Jul 14 17: 23 soft. Link-> original. File
The number of links is only a concept related to hard links.
You can track soft links from linked files (reverse tracing is not supported)
---------------
Because the file system structure such as inode is not bidirectional, you cannot find how many times an inode has been referenced. We can only use some techniques to track hard links.
1. Through the number of links, we can know which file has a hard link (greater than 1)
2. Find the inode ID of the file.
[Oracle @ DCM ~] $ LS-I hard. Link
1573158 hard. Link
3. Search for files by inode ID (if you need to traverse a large number of directories, the speed can be imagined)
[Oracle @ DCM ~] $ Find-inum1573158
./Hard. Link
./Original. File
4. Hard links are essentially multiple dentry pointing to the same inode, so there is no distinction between master and slave, and each dentry is equal.
Find all files with hard links greater than 2 in the system: # fin D/ -LI NKS + 2-type F