I have tried with a simple command:

cd Name of the Folder

but it's not working, of course.

I have also been searching on the web, but the methods I found are not actually working.

How can I accomplish this?

  • "not actually working" doesn't explain the problem you are facing. In case the answers below don't help you in solving the problem, please include the actual command you are executing and the error you get in your question. – nohillside Sep 19 '14 at 13:27
  • Thank you, all methods you suggested work perfectly now. I decided to not vote for none of you, because both answers are helpful :) +1 for both :) – nbro Sep 19 '14 at 13:36

The answers in the linked article are correct (but maybe hard to find among all the other information there). Key problem is that bash (and any other shell) use whitespace to separate between words, so any space characters within names (and any situations where such characters might occur) need to be protected/escaped.

cd "folder with whitespace in name"
cd folder\ with\ whitespace\ in\ name

and (if you have the name of the folder in a variable)

FOLDER_NAME="folder with whitespace in name"
  • I was trying with the second method, but I was trying wrongly, I was forgetting to insert the variable $VAR between quotes – nbro Sep 19 '14 at 13:32

To access files or directories that have spaces in them you have to tell Bash to ignore them (it uses spaces to delimit commands so it has to be told that the space in the file name is actually part of the filename)

to do that you need to put a backslash () in front of the space.


cd Name\ of\ the\ folder

However bash will help if you press the TAB key after the start of the filename i will autocomplete and take of the spaces for you

so type:

cd Name TAB and it will autocomplete.

You must log in to answer this question.

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