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 have a directory called "Reader 0.5" in my Desktop on Mac Os X. When to access the directory in terminal, I am using below code:

cd /Users/niho/Desktop/Reader 0.5

but it throws:

No such file or directory

error.

How can I cd into that directory?

Thanks.

share|improve this question

migrated from stackoverflow.com Mar 13 '11 at 12:17

This question came from our site for professional and enthusiast programmers.

3 Answers 3

Either you put quotes around the directory name (cd "/Users/niho/Desktop/Reader 0.5") or you escape the directory name (/Users/niho/Desktop/Reader\ 0.5).

share|improve this answer
3  
Just for the sake of completeness, you can also decide to quote just parts of the argument, like cd /Users/niho/Desktop/"Reader 0.5" or even cd /Users/niho/Desktop/Reader" "0.5 –  Pumbaa80 Mar 13 '11 at 12:14
2  
The last one (infix quotes) was new to me. Thank you! –  joschi Mar 13 '11 at 17:07

You can escape the space:

cd /Users/niho/Desktop/Reader\ 0.5
share|improve this answer

As others have mentioned, quoting the path or backslash-escaping the spaces will work.

In addition bash, the default shell on Mac OS X, supports command-line completion using the Tab key. So e.g. if you type:

cd /Users/niho/Desktop/Re

then press the Tab key, the shell will fill in the rest of the folder name (as long as there are no other folders on your Desktop starting with "Re"), and will take care of quoting the arguments to cd if there are spaces in the directory name it fills in.

share|improve this answer

Your Answer

 
discard

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