LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 11-23-2005, 10:09 AM   #1
gizmobay
LQ Newbie
 
Registered: Nov 2005
Posts: 17

Rep: Reputation: 0
Change directory command


Ok this should be an easy one but I can't figure it out. I have a directory called My Music (note the space). When I do a cd My Music, it says not found. How do I do a cd with a folder that has a space in the middle?

Thanks
 
Old 11-23-2005, 10:12 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Use a \:

cd My\ Music
 
Old 11-23-2005, 10:30 AM   #3
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
or cd my then hit tab would either auto complete if there's only one starting like that, or a few tabs shows the different directories, which would have shown you My\ Music
 
Old 11-23-2005, 02:26 PM   #4
AdaHacker
Member
 
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384

Rep: Reputation: 32
Or just put the directory in quotes.
Code:
cd "My Music"
 
Old 11-23-2005, 06:11 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Both single and double quotes can be used ... slightly different but nearly the same ... and the backslash "\" character is always recognized as an escape-character, nullifying any special meaning of the character (including a space) that immediately follows it.

Incidentally, the same tricks are used on the command-line in Windows.

info bash is a very handy thing to read... lots of cool time-saving tricks in there.
 
  


Reply



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
How do I change directory permissions ? cwolf78 Linux - Software 3 05-05-2005 12:15 PM
chmod command to change all files in directory paul_mat Linux - Newbie 2 01-10-2005 09:05 PM
How to change directory windefault Linux - Newbie 5 11-02-2004 04:28 AM
How to change directory? bngrhl Linux - Newbie 5 05-16-2004 01:20 AM
mountig - change ro to rw, delete directory, change rw to ro ?? itsjustme Linux - General 6 10-17-2003 11:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:55 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
Open Source Consulting | Domain Registration