3

I found this dir in my ubuntu server

momo@myubuntuserver:/$ cd /
momo@myubuntuserver:/$ pwd
/
momo@myubuntuserver:/$ cd //
momo@myubuntuserver://$ pwd
//
momo@myubuntuserver://$ cd ///
momo@myubuntuserver:/$ pwd
/

why this dir exists ? How does it work ?

9

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'.
| improve this answer | |
5

// is just / on Linux. As is ///, and ///bin//////ls is an alternative name for /bin/ls.

Type /bin/pwd to find out the real present working directory.

| improve this answer | |
  • The interesting question is why don't the shell prompt and pwd normalise // like they normalise ///? – Daniel Fischer May 7 '13 at 10:14
  • @DanielFischer: because according to the POSIX standard, // at the start of a path may have a special meaning to the OS, and Bash seems to cater to this. Linux doesn't attach such meanings, though. (I think Cygwin and other "Unix-for-Windows" packages use this to denote UNC network paths, but the convention goes back to Apollo Domain/OS.) – Fred Foo May 7 '13 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy