2

On the bash prompt one, three or more slashes (/,///,////, ...) are treated as a single slash, whereas two slashes (//) are left as is:

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

Usual suspects' versions:

12:07 $ bash --version
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)

12:20 $ dpkg-query -s coreutils | grep Version
Version: 8.21-1ubuntu5

marked as duplicate by chaos, Marco, maxschlepzig, jasonwryan, garethTheRed Nov 25 '14 at 8:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    duplicates: SO && U&L – rush Nov 25 '14 at 7:15
1

For displaying the current directory bash keeps some internal state that doesn't necessarily corresponds to the actual (shortest) path to the current directory. This helps in keeping the path if you cd through soft links.

The cd // (but also when doing e.g. cd //tmp) do not seem to trigger a sanitization of the internal path displayed by pwd, but more than two / seem to trigger this.

Not the answer you're looking for? Browse other questions tagged or ask your own question.