What does a hard link do?
Solution 1:
Both hard links and symbolic links link a path to a destination, however there is a substantial difference you should be aware of:
- Hard links link a path to a file. This means that if you rename/move the destination file, the hard link follows.
- Symbolic links link a path to a path. This means if you rename/move the destination file, the link is broken. However, later replacing the file with a different one will make the link work again.
Links of both types are made with the ln tool. Hard links are made without any options, whereas symlinks are made with the -s
option.
For more information on constructing the command, see:
- How can I create a symbolic link in Terminal?