LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Possibly the dumbest question I would ever expect to ask (https://www.linuxquestions.org/questions/linux-general-1/possibly-the-dumbest-question-i-would-ever-expect-to-ask-384521/)

pyrael 11-18-2005 10:15 PM

Possibly the dumbest question I would ever expect to ask
 
I have been using linux for quite some time now, but there is one thing that is REALLY erking me........
I dual boot XP and FC4, That works OK (wish I could just get rid of XP all together). My problem is with the command prompt. I mount the windows directory, usually with:
# mount /dev/hda1 /windows

Works fine, I can access the folder ok. But, I cannot cd to folders with names containing spaces! If I type ls, they exist..... so I know they are readable to linux. I can do this fine from the desktop (Gnome or KDE) but for some reason not from the command line. I tried using for example:

# cd /windows/Documents_and_Settings

#cd /windows/Documents%&and%&Settings

#cd /windows/Documents&%and&%Settings

#cd /windows/Documents%and%settings

as well as ALOT of other ascii combos I thought might work.

What makes it possible for gnome and KDE to navigate these folders?

pyrael 11-18-2005 10:20 PM

Cancel that question LOL

I figured it out after trying one last passing thought

#cd 'Documents and Settings'

That did it fine LOL

maybe someone else will wonder and and find this helpful

vharishankar 11-18-2005 10:29 PM

You can also do like this:

Code:

cd /mnt/C:/My\ Documents/Some\ Folder\ with\ Spaces
That is use the backlash as an escape character to use spaces which are part of file and folder names.

Note: The use of colours is just for easily understanding the folder names. Otherwise it might have been confusing.

tsphan 11-18-2005 10:30 PM

or, you could use a "\" as a sign to tell it to add the next character, for example:

Code:

$ cd Documents\ and\ Settings
\ is telling it to add the space.

pyrael 11-19-2005 12:35 AM

Thanks Harishankar and tsphan,

I'll set that to memeory, It's good to know... It was driving me batty for a while LOL

Optimistic 11-19-2005 05:30 AM

What's with all this pointless typing? Haven't you discovered the awsomeness that is TAB completion?

Type part of the file name then hit TAB and the directory will be typed for you. If there is more than one match then hit TAB again and it will show you what matches what you have so far.

Plus, this helps to cutdown on typing mistakes which waste time.

Try it out, I prommise that you will use it all the time.

In fact, I use it so much that I accidently assume that everything has tab complete and will hit TAB when I'm typing URLs sometimes.

linmix 11-19-2005 05:34 AM

Even when you use TABbing you need to know about escaping spaces (using '\ ') since there could be two direcories with the space in te same place:

My Documents
My Music

No amount of tabbing gets you through that one ;)

vharishankar 11-19-2005 11:28 PM

Quote:

No amount of tabbing gets you through that one
Ah, yes. Before I knew tab completion, I used to wrap it in quotes too :D

pyrael 11-22-2005 05:42 AM

I forgot about tabbing

I did use it for a long time, then I started using DOS again for a while (installing OS's for people) and got used to the DOS restrictions again.
It's really annoying to hit the up arrow and NOT have your last command listed again. LOL
I'll start using it again now that you reminded me :D although the escape is still very valid and useful info too

Optimistic 11-22-2005 05:52 AM

I didn't mean to suggest that knowing the escape character was unimportant---quite the contrary, you gotta know that. I just wanted to point out that TAB rules! :)


All times are GMT -5. The time now is 09:14 PM.