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 folder named abcd\fff\ggg\ddd

How do I cd into it?

share|improve this question
    
How on earth did you manage to get a folder with slashes in the name?! Most operating systems go well out of their way to prevent that from ever, ever happening. Also, what operating system are you using? It would make answering your question easier ;) –  nhinkle Aug 18 '10 at 22:32
    
im using ubuntu –  Or W Aug 18 '10 at 23:26
    
@nhinkle: I've noticed the opposite: Most operating systems allow everything that is not forbidden for a good reason. Any well-written Unix program — including Nautilus, GNOME's graphical file browser — will let you enter anything as file name (except a slash /). –  grawity Aug 19 '10 at 20:57
    
@nhinkle: (Well, okay, Nautilus won't let you enter newline characters. But it's as simple as mkdir "foo[Enter]bar" in the shell.) –  grawity Aug 19 '10 at 20:58
    
Ahhh, ok. On Windows, we use \ for directories, not / like on unix, so \ is therefore a prohibited character. That makes more sense now (and hence my question about the OS ;) ) –  nhinkle Aug 20 '10 at 9:57
show 1 more comment

2 Answers

up vote 6 down vote accepted

You have to escape the backslash character in order for it to work:

cd abcd\\fff\\ggg\\ddd/

Escaping means prefixing the backslash (also have to do this if the directory contains a space) with, funnily enough, a backslash. Linux interprets a single backslash as the escape character, allowing you to access directories and files containing spaces, backslashes, and other special characters.

That is best practice; it is a good idea to get in the habit of understanding how and when to use the escape character if you're going to be using Linux command line. The other answer provided:

cd 'abcd\fff\ggg\ddd'

will also work. I provided mine as a more complete and 'correct' answer, since understanding the concept of escape characters is essential to proper CLI interaction.

share|improve this answer
add comment
cd 'abcd\fff\ggg\ddd'
share|improve this answer
add comment

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.