Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 08-22-2003, 10:56 AM   #1
Registered: Aug 2003
Location: Canada
Distribution: Slackware, debian
Posts: 76

Rep: Reputation: 15
Newb question

Hey, how do I cd to directories with spaces in them? I'm browsing my windows drive and I type:

[j@localhost windows]$ cd Program Files
bash: cd: Program: No such file or directory

I also tried Program%Files but it didn't work either.

Old 08-22-2003, 11:21 AM   #2
Registered: Jul 2003
Location: Salt Lake City, UT and Spokane, WA
Distribution: Mandrake 10.0, Gentoo, FreeSBIE 1.0
Posts: 345

Rep: Reputation: 30
Oh shoot, I used to remember how to do this... but now I am just lazy when using cd and use wildcards... so in your case I would just type something like:

cd Prog*

That will work as long as you don't have two directories that are spelled the same prior to the space and differently after...
Old 08-22-2003, 01:12 PM   #3
LQ Newbie
Registered: Aug 2003
Distribution: RedHat 9.0
Posts: 10

Rep: Reputation: 0
try encapsulating the entire directory name within quotation marks..

cd "my directory"
Old 08-22-2003, 06:01 PM   #4
LQ Newbie
Registered: Aug 2003
Distribution: Mandrake 9.1
Posts: 21

Rep: Reputation: 15
hmmm......good question

when you want to go to a directory with spaces, for example (c:\)Program Files,

cd /Program\ Files

i think it also works with question marks aso....

cd /mp3/band\-album

the backslash is the key
Old 08-22-2003, 06:26 PM   #5
Registered: Jul 2003
Location: British Columbia, Canada
Distribution: CollegeLinux 2.5
Posts: 148

Rep: Reputation: 15
I always just put it in quotation marks. Seems easiest.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newb C++ question Scotty2435 Programming 9 03-05-2006 05:38 AM
Newb question sicness Slackware 4 11-09-2005 04:40 AM
Newb Question Tsarok Fedora 5 07-14-2005 03:05 PM
Newb Question nFecTeD Linux - Newbie 1 06-07-2005 07:24 PM
A Newb Question pt. 2 gnr2k3 Linux - Newbie 3 08-30-2003 06:37 PM

All times are GMT -5. The time now is 09:35 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration