LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-04-2016, 10:29 AM   #1
blacktape
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?

Code:
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
root@host:/#
 
Old 07-04-2016, 10:51 AM   #2
hydrurga
Senior Member
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 18.1 MATE
Posts: 3,091

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

http://tiswww.case.edu/php/chet/bash/FAQ

Quote:
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 11:06 AM.
 
Old 07-04-2016, 10:56 AM   #3
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 329

Rep: Reputation: 126Reputation: 126
I haven't found an answer to that on Linux Questions, but here's an answer from Stack Overflow:
http://stackoverflow.com/questions/2...-mean-in-linux
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, 11:38 AM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 5,388

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


Reply


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 09:02 AM
".config" and ".kde" folders are being created under root directory (Slack Current) piratesmack Slackware 8 03-12-2011 11:06 PM
[SOLVED] Errors executing shell script: "command not found" and "no such file or directory" eko000 Linux - Newbie 1 01-14-2011 07:54 AM
"Permission denied" and "recursive directory loop" when searching for string in files mack1e Linux - Newbie 5 06-12-2008 07:38 AM
What does "Directory "/usr/src/linux" doesn't appear to contain kernel source." mean? jtp51 Linux - General 4 06-11-2007 12:22 AM


All times are GMT -5. The time now is 11:17 PM.

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