Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is path //, how is it different from /

We know root directory is /, and according to posix, there is another directory // which differs from /. When you ls / and ls //, the output is the same, so as stat, however if you cd / and cd //, they are different, though the directory content are the same. That really confused me. Anyone got an answer?

like image 725
dspjm Avatar asked May 30 '13 16:05

dspjm


1 Answers

From 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 server `hostname'.
like image 77
devnull Avatar answered Oct 15 '22 11:10

devnull