37 / 102
Symbolic Links
ln
- Make links between files. By default, it makes "hard links".
With the
-s
option, it makes symbolic (or "soft") links.
A "hard link" is another name for an existing file.
The link and the original are indistinguishable (they share the same inode).
Caution: the link can be removed without removing the file
with unlink
, but rm
will remove the link and
the file.
A symbolic link, on the other hand, refers to a different file. Most operations (opening, reading, writing, and so on) are passed the symbolic link file, the kernel automatically "dereferences" the link and operates on the target of the link. But some operations (e.g. removing) work on the link file itself, rather than on its target.