A hardlink is a file pointing to the same disk location as another file. On the other hand, a softlink (or symlink) is a file containing the path to another target file. Represented diagramatically:
File Target
F1 -> D1
F2 -> D1
F3 -> F4
Here, F2
is a hardlink to D1
whereas F3
is a symlink to F4
.
Symlinks are preferred when shortcuts or shorthand paths are needed to files or directories. A hardlink on the other hand acts as a “backup” copy without occupying more space (useful behavior for version control).
I came across this in a blog for uv
where they mention that using hardlinks helps optimize disk usage for Python environment management.