Back to CFM home             Brown University

Understanding the location of linked directories

There is a subtle difference between a "normal" directory and a directory created with a symbolic link to another directory.

What happens if you do a cd (change directory) to this type of directory? You are placed in the directory that the symbolic link points to.

This can be confusing, especially if you have changed your shell prompt so that it displays the current working directory.

Look at this example:

       (print the user's working directory)
   ln -s $HOME/accounts/may fifth
       (use a symbolic link named fifth that points to
        the directory $HOME/accounts/may)
   cd fifth
       (change directory to the new directory)
       (print the working directory)
       (the user is actually in the the directory that the
        linked directory points to)

When the user does a cd (change directory) to the symbolically linked directory may in their current working directory, they change to the directory that this link points to, the directory /usr/home/john/accounts/may.

[Home] [Search] [Index]