LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't open a two word directory. (https://www.linuxquestions.org/questions/linux-newbie-8/cant-open-a-two-word-directory-735337/)

swamprat 06-24-2009 12:39 PM

Can't open a two word directory.
 
I have the following directory under my root directory:

My Documents

It's two words and I can't CD to it.

Is there anyway to use the ls -la command to CD to this directory?

Thanks

kirukan 06-24-2009 12:49 PM

ls is used for list the content within current directory, i dont know how to use ls -al for cd to the directory. however
cd, type the first word of the directory "M" and use the tap key or from ls -al out put copy the name of the directory and paste it
OR
rename the "My Documents" directory as a one word name and then try to cd to that directory

Uncle_Theodore 06-24-2009 12:56 PM

If you don't want to rename it,

cd My\ Documents

should do the trick.

jdkaye 06-24-2009 12:58 PM

From a terminal you type this:
Code:

cd /home/{myhomedir}/My\ Documents
cheers,
jdk

john test 06-24-2009 04:05 PM

Code:

mkdir "my documents"
cd "my documents"
rmdir "my documents"


chrism01 06-24-2009 07:56 PM

Yep, alternatives include

1. escape the space '\'
2. use double quotes
3. use single quotes
4. rename to something sane eg change space to underscore (my favourite)

IME, file/dir names native to *nix don't have spaces in them, even though its legal to do so.
Most *nix tools use space to separate args on there cmd line, which is prob why we don't have spaces in a file/dir name

GrapefruiTgirl 06-24-2009 08:12 PM

try cd my?documents

Works here nicely, :)
Sasha

Tinkster 06-24-2009 08:32 PM

Quote:

Originally Posted by GrapefruiTgirl (Post 3585339)
try cd my?documents

Works here nicely, :)
Sasha

Heh ... while that works it's not lazy enough ... you have
to type the whole thing out! 'cd my\ d' will allow for
tab expansion, saving 7 key-strokes (if there's no other
dirs that start with my\ d, that is) ;D



Cheers,
Tink

GrapefruiTgirl 06-24-2009 08:43 PM

Not lazy enough?? :confused: Sheesh!

Well then make sure it's the only folder in the working directory, and type:

cd *

I can't make it any lazier than that :D

PS - where's the OP? I wonder if any of these options is working..

Sasha


All times are GMT -5. The time now is 12:38 AM.