LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-24-2009, 12:39 PM   #1
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, (Which Exit LOL), USA
Distribution: Centos 6.7 Under VMware in Win7
Posts: 461

Rep: Reputation: 34
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
 
Old 06-24-2009, 12:49 PM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,274

Rep: Reputation: 148Reputation: 148
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
 
Old 06-24-2009, 12:56 PM   #3
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
If you don't want to rename it,

cd My\ Documents

should do the trick.
 
Old 06-24-2009, 12:58 PM   #4
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
From a terminal you type this:
Code:
cd /home/{myhomedir}/My\ Documents
cheers,
jdk
 
Old 06-24-2009, 04:05 PM   #5
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
Code:
 mkdir "my documents"
cd "my documents"
rmdir "my documents"
 
Old 06-24-2009, 07:56 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,357

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
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
 
Old 06-24-2009, 08:12 PM   #7
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
try cd my?documents

Works here nicely,
Sasha
 
Old 06-24-2009, 08:32 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by GrapefruiTgirl View Post
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
 
Old 06-24-2009, 08:43 PM   #9
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Not lazy enough?? 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

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

Sasha
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Word of the Year: Open LXer Syndicated Linux News 0 01-01-2008 06:50 PM
Why wont ms word read open office brotell Linux - Desktop 3 02-14-2007 07:44 AM
Evolution - open word docs with open office (not KWord) bcarl314 Mandriva 1 06-11-2005 09:18 AM
open office and ms word davidleroux1 Linux - General 2 10-26-2004 02:45 PM
Open Office Vs Wine WORD yourEgg Linux - Software 3 07-15-2004 01:10 PM


All times are GMT -5. The time now is 01:31 PM.

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