Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Change directory:

$ pwd
$ cd bin && pwd

With .., same outcome:

$ pwd
$ cd bin/../bin && pwd

But why? Why the shell is not throwing an error?

share|improve this question
up vote 3 down vote accepted

Well ".." is a normal entry in the directory (as is ".") as you can see by "ls -la" for example and points to the parent directory.

So splitting your "cd bin/../bin" makes you move from usr to usr/bin, then back to usr, then back to usr/bin. After each "/" the directory move is made.

You can also try cd bin/./././../bin/../bin/./. in case :)

share|improve this answer
Shell just splits the path by / into tokens and keep changing the directory according each token until all tokens are exhausted or error occurs? Any impact of keeping doing ../../../..? – realguess Dec 18 '13 at 6:56
Exactly it just splits and then executes every single token. So doing ../../../.. will move you backwards in the directory tree by 4 levels (of course given the fact that this path exists) – fede.evol Dec 18 '13 at 6:59
Actually, it's not "exactly" that. It isn't the shell doing the path processing (on most operating systems). It's the operating system kernel. And whether the root is its own parent directory (which affects whether you can keep adding .. path components willy-nilly) is something that varies from operating system to operating system. – JdeBP Dec 18 '13 at 13:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.