Table of Contents
Relative source path of symlink discussion
It's important to realise that the first argument after
ln -sis stored as the target of the symlink. It can be any arbitrary string, but at the time the symlink is being used and resolved, that string is understood as a relative path to the parent directory of the symlink (when it doesn't start with
total 0 lrwxr-xr-x 1 yeonghoey staff 3B Aug 13 15:54 foo -> foo
total 0 lrwxr-xr-x 1 yeonghoey staff 6B Aug 13 15:58 foo -> ../foo Hello, World!
Subtlety of Following Symlinks discussion
The general rule is,
- if a command operates on links (i.e. directory entries, which are pointers to inodes)
- The command treats symlinks as themselves rather than as the object the link points to.
- The command operates on what the symlink points to.