Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.

There is actually a similar question and the solution is described there: How Linux handles multiple path separators.

share|improve this answer
2  
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .