Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-04-2016, 11:29 AM   #1
LQ Newbie
Registered: Jul 2016
Location: Calcutta, India
Distribution: Kali Linux
Posts: 1

Rep: Reputation: Disabled
"cd //" changes directory to //

I was just playing with the Kali Linux terminal until I had mistakenly entered cd //, and to my surprise the directory indeed changed to //. I thought this might be some bug in Kali but Ubuntu does that too.
Moreover, creating a directory in //, creates a directory in / too. What is happening here? Are they same thing? Then why two locations?

root@host:~# cd //
root@host://# ls
0          boot  home        lib64       mnt   root  srv  usr
bin        dev   initrd.img  lost+found  opt   run   sys  var
blacklist  etc   lib         media       proc  sbin  tmp  vmlinuz
root@host://# mkdir example
root@host://# cd /
root@host:/# ls
0          boot  example     lib         media  proc  sbin  tmp  vmlinuz
bin        dev   home        lib64       mnt    root  srv   usr
blacklist  etc   initrd.img  lost+found  opt    run   sys   var
root@bhost:/# rm -r example
Old 07-04-2016, 11:51 AM   #2
Senior Member
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 18.2 MATE
Posts: 3,491
Blog Entries: 2

Rep: Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196
Check out section E10 in the Bash FAQ here:

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

Last edited by hydrurga; 07-04-2016 at 12:06 PM.
Old 07-04-2016, 11:56 AM   #3
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 361

Rep: Reputation: 157Reputation: 157
I haven't found an answer to that on Linux Questions, but here's an answer from Stack Overflow:
To paraphrase that answer, three or more consecutive slashes will always be interpreted as a single slash, and two consecutive slashes at the beginning of the path may have special significance (e.g., remote file access as //hostname/path) in some implementations.
Old 07-04-2016, 12:38 PM   #4
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 5,396

Rep: Reputation: 410Reputation: 410Reputation: 410Reputation: 410Reputation: 410
Normal in Kali to have vmlinuz + initrd in / ?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] A "DropBox" question, error: Can't sync:".directory":access denied. Robert.Thompson Slackware 4 08-25-2011 10:02 AM
".config" and ".kde" folders are being created under root directory (Slack Current) piratesmack Slackware 8 03-13-2011 12:06 AM
[SOLVED] Errors executing shell script: "command not found" and "no such file or directory" eko000 Linux - Newbie 1 01-14-2011 08:54 AM
"Permission denied" and "recursive directory loop" when searching for string in files mack1e Linux - Newbie 5 06-12-2008 08:38 AM
What does "Directory "/usr/src/linux" doesn't appear to contain kernel source." mean? jtp51 Linux - General 4 06-11-2007 01:22 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:42 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration