What is a Hard Link in Linux? – Explanation and Usage

hardlinklinux

I have searched around and am trying to understand the difference between a hard link and symbolic link (soft link).

I found this link is quite useful. But I am still not very clear. I understand soft link is not a copy of original file, but is a hard link a copy or not?

Best Answer

To use an analogy from mail delivery, a symbolic link is something like a forwarding address... when something tries to open a symbolic link, it opens the "file" (not literally a file, though) stored there, and sees that it should instead look at a file with a different name, so it opens the other file instead.

A hard link is more like having two addresses for the same place. (Of course this isn't really possible in the physical world). When something tries to read either file name (address), they get the same physical file (location).

So a hard link is not a copy, because the file is only stored once (but with multiple names). But it behaves very much like a copy, because you can access the same information from two file names.

Related Question