From the manual of coreutils, for ln
When creating a relative symlink in a different location than the current directory, the resolution of the symlink will be different than the resolution of the same string from the current directory. Therefore, many users prefer to first change directories to the location where the relative symlink will be created, so that tab-completion or other file resolution will find the same target as what will be placed in the symlink.
The string stored in a relative symlink is determined completely by the source pathname and the target pathname, both specified as command line arguments to ln
.
I don't see how the current directory gets involved. So I don't quite understand the reason why many users prefer to change the current directory to the parent directory of a to-be-created relative symlink before creating it. Could you rephrase or give some examples? Thanks.
ln
. I don't see how the current directory gets involved. – Tim Jul 3 '16 at 21:36