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

On various linux machines you can

cd /


cd //

The shell will say the current directory is '/' or '//' after using the corresponding command.

So the question is: What is the difference between '/' and '//', and if the answer is 'no difference' then why is '//' shown differently than '/'


cd ///
cd ////
cd /////

All result in the shell saying the current directory is '/'

Heres an example session:

[user@host /]$ cd //
[user@host //]$ cd /
[user@host /]$ cd //
[user@host //]$ cd /
[user@host /]$
share|improve this question
This appears to be a bash-specific anomaly. If you try cd // in csh or zsh and then pwd it will show just '/' – Doug Harris Oct 14 '09 at 17:24
interesting - that sheds some light on it – sylvanaar Oct 14 '09 at 17:29
For comparison: cd //usr/bin gives "//usr/bin", but cd /usr//bin gives "/usr/bin" (in Bash). – Dennis Williamson Oct 14 '09 at 18:40
up vote 14 down vote accepted

Let's ask the man himself (Chester Ramey):

E10) Why does 'cd //' leave $PWD as '//'?

POSIX.2, in its description of 'cd', says that three or more leading slashes may be replaced with a single slash when canonicalizing the current working directory.

This is, I presume, for historical compatibility. Certain versions of Unix, and early network file systems, used paths of the form //hostname/path to access 'path' on server 'hostname'.

share|improve this answer
Much better answer than the (already pretty good) one from John T. – innaM Oct 14 '09 at 20:32

It isn't an actual directory, it's a problem specific with bash. It's referenced in The Linux Documentation Project.

share|improve this answer
why hasn't anyone fixed it? or have they? – sylvanaar Oct 14 '09 at 17:49

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.