[LBo] Re: Symlink peculiarities (Anerobe)
Brice Hunt
shoalcreek5 at gmail.com
Mon Jan 8 22:16:26 CET 2007
Also, symlinks always point to whatever path they were created with. If
you use the full path name to the file you are linking to, it doesn't
matter where you put the symlink on the system, it will always point to
the same spot. If you use a relative path to create the symlink, it
will always point to the location that is relative to where ever you put
your symlink. For example, if a user with the username "collin" issued
the following command:
ln -s ~/documents/myfile.odt mylink
then "mylink" will always point to /home/collin/documents/myfile.odt no
matter where the link is placed in the file system. Whereas:
ln -s ../documents/myfile.odt mylink
Will always try to go up one directory from where the link is located,
find a subdirectory named "documents," and then finally find a file in
that directory named myfile.odt. In this case, if you were to move the
link to some bizarre location in your file system, it would no longer
point to the right location. Likewise:
ln -s myfile.odt mylink
Will always try to find a file named myfile.odt in whatever directory in
which the link is placed. If you move it to any directory that has no
"myfile.odt," it will no longer be a usable link.
Brice
More information about the QnA
mailing list