0

Suppose this directory structure:

/folder1/
/folder2/

Now, if I enter

cd /folder1
ln -s /folder2 linkToFolder2
cd /folder1/linkToFolder2
ls ..

I thought that, given that pwd is /folder1/linkToFolder2, doing a "ls .." would return /folder1's contents. However, it is returning folder2's. Is this behavior correct?

  • 3
    Does it answer your question? http://unix.stackexchange.com/questions/180620/understanding-directory-symlinks-traversals-and-the-parent-directory – capum May 29 '16 at 07:56

1 Answers1

0

Your link points to /folder2.Your pwd is /folder1/linkToFolder2, that is the same than /folder2/, and 'ls ..' in all the cases should show you the above directory, whether if you are in /folder1 or /folder2

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232