In the first line, the fun shows the original file and fun-sym shows the symbolic link file.
While in the second and third line why is it necessary to add "../" before fun and not only just fun.
Typing only fun gives a broken link.
Because the sym-links must be either:View attachment 9769
In the first line, the fun shows the original file and fun-sym shows the symbolic link file.
While in the second and third line why is it necessary to add "../" before fun and not only just fun.
Typing only fun gives a broken link.
$HOME
, or by the shell shortcut ~/
, or by the absolute path /home/yourusername/
, or by the relative path ./
(because it’s the directory we’re currently in.ln -s fun fun.sym
ln -s ../fun dir1/fun-sym
fun-sym
to be put into a sub-directory called dir1
.dir1/
(which is the same as the relative path ./dir1
, or the absolute paths $Home/dir1
, or ~/dir1
, or /home/yourusername/dir1
)dir1
.dir1
, then as a relative path, it’s target will be up one directory. So if you are going to use a relative path to the target, the path must be in relation to where the sym-link WILL be. NOT in relation to where we currently are. Therefore, you must use the relative path ../fun
for the sym-links target.ln -s $HOME/fun dir1/fun-sym
ln -s ~/fun ./dir1/fun-sym
ln -s /home/yourusername/fun ./dir1/fun-sym
dir1
and ./dir1
are both exactly the same thing.