Difference Between a Symbolic Link and a Hard Link(toolhub.tech) |
Difference Between a Symbolic Link and a Hard Link(toolhub.tech) |
Files don't have names. At least, they don't have names for themselves. Instead, they have unique ids (i-node numbers).
But obviously we use names for files, which happens because a directory can give a name to a file. However, the name is just that directory's name for the file.
There is no rule against multiple directories each giving their own name to a file, and there is no rule against one directory giving multiple names to a file.
So a "hard link" is not some special, different type of thing. It's another instance of the same type of thing that happened when you first created the file. So it's clearer (to me) to either not think of any of them as hard links or to think of all of them as hard links.
I came to that realization when I needed to delete a file and the function call to use was named `unlink`.
So on your NFS mount you could have different files for, say, /bin/ls, based on architecture, or /etc/hostname that differed by the name of the host.
I always thought CDFs were pretty clever, but they never seemed to gain any traction.
Learned a hard lesson about backups that day. I did have some, but of course we still lost some data.
(Or at least I think so - not a Linux expert here)
Hard links are only indicated by a link count >1 for files, but to find them, you must search by inode number (since they all share the same inode number) - e.g., ls -i to list inode numbers, and find / -inum 1234 (for inode 1234) to find them on the same filesystem.
find / -samefile /path/to/some/hard/link
https://learn.microsoft.com/en-us/sysinternals/downloads/jun...