LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 04-17-2009, 12:28 PM   #1
bobby953
Member
 
Registered: Mar 2009
Posts: 41

Rep: Reputation: 15
Smile Hidden backslash in dir name


Hi
I copied a music folder from my Win XP to my Linux Server via Samba (Drag and Drop in Windows through Network Neighborhood).

Now, on my server, when I do a ls, the dir name appears as such
ENYA - 1995 - The Memory of Trees

But when I want to cd into it, I have to type:
cd ENYA\ -\ 1995\ -\ The\ Memory\ of\ Trees

Otherwise, I can't change into the dir. Why are these '\' hidden in the directory name
I'm curious. Please let me know. Thanks all in advance.
 
Old 04-17-2009, 12:43 PM   #2
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
That is how file names with spaces are handled under Linux, it is normal. If you don't want to type the slashes, put the whole thing in quotes like:

Code:
cd "ENYA - 1995 - The Memory of Trees"
Your shell should be able to finish the file name properly with Tab completion once you start with the quotation marks.
 
Old 04-17-2009, 12:47 PM   #3
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Rep: Reputation: 188Reputation: 188
Quote:
Originally Posted by bobby953 View Post
Hi
I copied a music folder from my Win XP to my Linux Server via Samba (Drag and Drop in Windows through Network Neighborhood).

Now, on my server, when I do a ls, the dir name appears as such
ENYA - 1995 - The Memory of Trees

But when I want to cd into it, I have to type:
cd ENYA\ -\ 1995\ -\ The\ Memory\ of\ Trees

Otherwise, I can't change into the dir. Why are these '\' hidden in the directory name
I'm curious. Please let me know. Thanks all in advance.
"\" means escape.

Basically you are telling the shell to "ignore" the spaces...

FYI...



Maybe I'm "old school". But I think that you should never put spaces in file names...

If I absolutely need separation; I use underscore (i.e. ENYA_1995_The_Memory_of_Trees)

But I'm probably alone on this one :P

-C
 
Old 04-17-2009, 12:53 PM   #4
bobby953
Member
 
Registered: Mar 2009
Posts: 41

Original Poster
Rep: Reputation: 15
Thanks tons for such a prompt answer.
 
Old 04-17-2009, 01:02 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Quote:
Originally Posted by custangro View Post
Maybe I'm "old school". But I think that you should never put spaces in file names...

But I'm probably alone on this one
Nope, you are not alone......
Filenames should not have spaces.
People should learn the CLI
And filenames should not have more than 8 characters...
And real men program Fortran with punch cards....

(I guess I'm older school than you.....)
 
Old 04-17-2009, 01:23 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,132
Blog Entries: 54

Rep: Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790
Ah, and you forgot that 640K ought to be enough for anybody.
 
Old 04-17-2009, 01:55 PM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Ummmm, 640K is HUGE.....
Apple-II 64K
Mac 128K

Almost forgot: I did a paper in college on magnetic core memory. In those days, you could actually SEE a bit.....
 
Old 04-17-2009, 02:01 PM   #8
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,231
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
Quote:
Originally Posted by custangro View Post
Maybe I'm "old school". But I think that you should never put spaces in file names...

If I absolutely need separation; I use underscore (i.e. ENYA_1995_The_Memory_of_Trees)

But I'm probably alone on this one :P

-C
Definitely not alone on this one.. I even do that on Windows systems out of habit
 
Old 04-18-2009, 12:37 AM   #9
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 666

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by pixellany View Post
ummmm, 640k is huge.....
Apple-ii 64k
mac 128k

almost forgot: I did a paper in college on magnetic core memory. In those days, you could actually see a bit.....
pdp-11 - 64 kb (without memory dispatcher)
 
Old 04-18-2009, 11:46 AM   #10
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Rep: Reputation: 188Reputation: 188
Quote:
Originally Posted by farslayer View Post
Definitely not alone on this one.. I even do that on Windows systems out of habit
Nice to see that I'm not the only "crazy" one
 
  


Reply

Tags
dir, name


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
copy svn working dir without svn hidden dirs and files? erinspice Linux - Software 4 03-29-2011 05:58 PM
Command to display /dir, /dir/sub, /dir/sub/files knockout_artist Linux - Newbie 9 10-25-2007 02:57 PM
backslash in vi ashlesha Linux - Newbie 5 02-24-2007 06:27 AM
Backslash in URL Cynthia Blue Linux - Newbie 17 08-18-2003 07:36 AM
Apache: Need backslash to indicate directory? kipbenson4 Linux - Software 2 08-12-2003 09:13 PM


All times are GMT -5. The time now is 12:30 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration