Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use the following commands to change directory and it generally works fine.

[max@localhost max]$ cd /
[max@localhost /]$ cd /home/max/
[max@localhost max]$ pwd
/home/max

But today, by mistake, I entered two // instead of one / and to my surprise, it works as well. So, I tried with various examples and all of them works just fine without giving any sort of an error.

[max@localhost /]$ cd /home///////////////max/////////////////////
[max@localhost max]$ pwd
/home/max
[max@localhost max]$ cd /
[max@localhost /]$ cd /////////////////home/max///////////
[max@localhost max]$ pwd
/home/max

What does these forward slashes mean (/ and ///////) and what do they do and represent?

share|improve this question

1 Answer 1

There is actually a similar question and the solution is described here (so I'll not duplicate the answer):

How linux handles multiple path separators (/home////username///file)

Basically it's defined by IEEE standards:

A pathname may optionally contain one or more trailing slashes. Multiple successive slashes are considered to be the same as one slash.

share|improve this answer
1  
It simplifies combining paths by allowing you to avoid testing for leading or trailing slashes. You can just do path1 + "/" + path2 and it will work whether or not path1 has a trailing slash and/or path2 has a leading slash. –  David Schwartz Aug 9 '12 at 13:24

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.