0

What is the meaning of the directory specified by '//'?

It can be accessed by typing in 'cd //' at the comand prompt.

I have tried this on mac 10.9.5 and Centos 6. It shows the contents for the root directory. In the prompt it shows '//' for the directory. Is this simply a glitch in the prompt code? I use \w to show the working directory.

agfsgafg
  • 101
  • 2

2 Answers2

0

cd // = Change the shell working directory to the root directoy

0

Historical compatibility because early versions of Unix used paths such as //host/path.

From the bash FAQ:

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 serverhostname'.

pullsumo
  • 382