Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Moving up a directory tree ?
To move up one directory, use cd .. To move up 2 levels, use cd ../../ Why do we need to use the / ? Why cant we use .. multiple times instead ?
William LiCourses Plus Student 26,868 Points
I believe the case that David Tonge mentioned, directory name with a space, we use backslash as escape character, not forward slash.
In UNIX, forward slash is used strictly as directory path separator; for example,
When you see couple dots .. in between //, that means navigate one level up to the current directory's parent directory. This notation comes up quite often when loading a source file (image/css/js) into a HTML page.
Hope this helps.
I think in the case of using the terminal the "/" is kind of an escape character. You can't use spaces in the terminal. Let's say I wanted cd to a directory named "Raj S" i'd have to put in quotes by using cd "Raj S" or using escape characters. So in your case using cd ../../ is kind of an shortcut instead of using cd .. cd .. twice.