What’s the difference between hard links and copied files

fileshard linkrhel

My understanding is that hard links include a copy of the original file, and that I could delete a hard-linked file in one location, and it would still exist in the other location.

If that's the case, why would I want to use hard links at all? Why not just have two separate files?

Best Answer

If you copy a file, it will duplicate the content. So if you modify the content of a single file, that has no effect on the other one.

If you make a hardlink, that will create a file pointing to the same content. So if you change the content of either of the files, the change will be seen on both.

Related Question