Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-23-2005, 11:09 AM   #1
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?

Old 11-23-2005, 11:12 AM   #2
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, 11:30 AM   #3
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, 03:26 PM   #4
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384

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

Rep: Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185Reputation: 3185
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.


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

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

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
Open Source Consulting | Domain Registration