Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

i was working in my terminal, and than i misspelled when cd to root /

accidentally i typed // and i got that in terminal as :

root@weblocalhost://#

when i type pwd, i get response // but when i type ls -s i got same list as in / directory.

when you type more than 2, i.e. /// you get:

root@weblocalhost:/#

always as 1 / except for 2. is there any difference and what is for // ???

share|improve this question
add comment

2 Answers

You can add multiple slashes to a directory and it will not change anything.

E.g. these three commands all do the same:
cd /home
cd /home/
cd /home//

After any of these my current working directory is is set to /home (check with pwd).

I guess that you have your prompt configured to do something smart and that you ran into unanticipated behaviour. What do you get when you echo $PS1 ?

Link to a comment on http://unix.stackexchange.com/ which may explain it.

share|improve this answer
    
My PS1 in bash on OSX is "\h:\W \u\$" and I get this strange behavior, too. / and /// and //// and ///// all show up as /, but the special case of two forward slashes shows up as two forward slashes. –  Sparr Mar 28 '13 at 16:55
    
I got the \u@\h:\w (<b>u</b>ser at <b>h</b>ost, <b>w</b>orking dir) in Ubuntu 12.10 but I fail to reproduce the problem. –  Hennes Mar 28 '13 at 16:58
    
no i get always // when checking pwd in any case. for echo $PS1 i get: [\e]0;\u@\h: \w\a]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ –  Dimitris Theodoridis Mar 28 '13 at 16:59
    
I just manually set my PS1 and I can not reproduce it with two slashes. Weird. Not with 1, 3 or 4. Only with 2. I am at a loss to explain this. –  Hennes Mar 28 '13 at 17:07
    
Maybe this comment from unix.stackexchange is the answer: I believe that Windows POSIX compat APIs will also treat //remote/... the same as the UNC path \\remote\... format. – Stephen P Jan 20 '11 at 0:39 –  Hennes Mar 28 '13 at 17:09
add comment

/ is == to //

See : http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_266

For a nice discussion of exceptions (cygwin and directories) see : http://unix.stackexchange.com/questions/1910/how-linux-handles-multiple-path-separators-home-username-file

share|improve this answer
    
thanks bro i will have look later sure! thanks –  Dimitris Theodoridis Mar 28 '13 at 17:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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