Symbolic vs hard links

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the unix category.

Last Updated: 2024-04-24

The difference is that a symbolic (aka "soft" link will no longer work if you delete the original. However a hard link is a mirror copy of the original file. It survives if you delete the original.

# To create a hard link, give `ln` the default (no -s flag)
$ ln source.file hardlink.file

# To create a symbolic link use the `-s` flags
$ ln -s sourcelfile softlink.file

Other differences: