The linked files may be anywhere in the file system, not just in a direct parent. This will report all files with three or more hard links in your home directory, grouped by inode. You may have spotted one example, but there may be others of interest:
find ~ -type f -links +2 -printf 'inode %i links %n name %p\n' | sort -n
I don't have any 3-ways, but this is my test for global two-way hard links.
$ find ~ -type f -links +1 -printf 'inode %i links %n name %p\n' | sort -n
find: ‘/home/paul/.gvfs’: Permission denied
find: ‘/home/paul/.cache/dconf’: Permission denied
inode 6173828 links 2 name /home/paul/Calhoun.post
inode 6173828 links 2 name /home/paul/SandBox/JpgTool/Calhoun.again
inode 6296398 links 2 name /home/paul/SandBox/fileGroup/fileGroup.V05
inode 6296398 links 2 name /home/paul/SandBox/fileGroup/myHardLink
find -samefile
, andtouch foo1; ln foo1 foo2; find . -samefile foo1
, lists./foo1
and./foo2
, isn't that what you want?-samefile
option. You give the name of any one of the hard links, andfind
gets its inode reference and then searches for all directory entries that refer to the same inode.find
command with the-samefile
option, it only showed me the one hardlink. But I admittedly am very newbish when it comes to thefind
command. It never seems to work how I expect. That's on me, being a hobbyist and not a professional though.