0
$ cd /
/$ ls
bin   dev  home        initrd.img.old  lib64       media  opt   root  sbin  sys  usr  vmlinuz
boot  etc  initrd.img  lib             lost+found  mnt    proc  run   srv   tmp  var  vmlinuz.old

/$ cd //
//$ ls
bin   dev  home        initrd.img.old  lib64       media  opt   root  sbin  sys  usr  vmlinuz
boot  etc  initrd.img  lib             lost+found  mnt    proc  run   srv   tmp  var  vmlinuz.old
//$ pwd
//

//$ cd ///
/$
/$ pwd
/

What is this trickery? What is //?

Vorac
  • 2,957
  • 8
  • 36
  • 53
  • @JeffSchaller the linked question indicates that [A pathname that begins with two successive slashes may be interpreted in an implementation-defined manner, although more than two leading slashes shall be treated as a single slash.](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11) I am still curious as to why Linux implements in this way. Why the complexity of special behaviour? Only because it is permitted by the standard? Are there any non-obvious differences between the `/` and `//` directory? โ€“ Vorac May 29 '18 at 01:14
  • an `ls -lid / //` would probably show the same inode --> the same directory. Per the linked duplicate, `There is one exception: if a pathname starts with exactly two slashes, it may be treated differently (ref: base definitions ยง4.11 pathname resolution). Linux itself doesn't do this` โ€“ Jeff Schaller May 29 '18 at 01:35
  • "What you're seeing is not, in fact, Linux doing anything special with //: it's bash's current directory tracking" โ€“ muru May 29 '18 at 03:00

0 Answers0