|
|
|
|
|
by adrianmonk
1171 days ago
|
|
What made it click for me mentally was this thought: there's no such thing as a hard link. Or alternatively, every file is a hard link. 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`.