[LBo] Re: Re: Symlink peculiarities (Anerobe)
Anerobe
anerobe at yahoo.com
Tue Jan 9 05:05:06 CET 2007
Brice Hunt wrote:
> 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.
Please excuse me, I'm a recovering windowholic, and have periodic relapses.
I didn't understand the "relative path" effect.
On a simplistic level it is as though I sent you the directions I follow to
get from my home to the grocery... (turn right at the stop sign; then right
at the light; and in two miles it will appear on your left), expecting you
to use them from your house.
Thanks for the clarification and insights!
More information about the QnA
mailing list