Spaces (and other characters) in filenames

Freddie Cash fcash-ml at sd73.bc.ca
Wed Aug 23 17:06:48 UTC 2006


On Wed, August 23, 2006 9:27 am, Dotan Cohen wrote:
> On 23/08/06, Kelly L. Fulks <kfulks at knology.net> wrote:
>
>> I was unaware that Linux hates the practice of using spaces in
>> filenames.  I guess those directories and files laying around for
>> the past 13  years on my various Linux systems with spaces in them
>> aren't really there:-)  If you are attempting to access a file with
>>  spaces in its name from the command line, then there are special
>> ways of doing so, but from Konqueror or most other GUI apps, it is
>> not a problem at all from my experience.
>>
>> Also to the best of my knowledge, the filesystem itself doesn't
>> have any major rules as to filenames except length.  You can use
>> almost any character in a filename.  However, the same thing
>> applies to accessing the files from the command line.  Certain
>> characters are reserved by the Unix/Linux shells and to use these
>> characters, you must escape them on the command line.  So if you
>> want to use a filename of "a b", from the command line you would
>> have to type "a\ b" to access it (or you can enclose it in quotes).
>> If you want to use a filename of "a>b", then from the command line
>> you would have to type "a\>b" (or you can enclose it in quotes).

> Kelly, we also have lots of directories and filenames with spaces. I
> was refering to the difficulties (at least at my level) of
> interacting with those files on the command line.

What's difficult?  Just put "" around the filenames and everything
Just Works.  :)  Works with any and all command line apps.  If there's
some really crazy characters in the file/directory name (like * or ?),
then use single quotes '' instead.

# cd "/some/long directory_path/With weir' names/and_ filenames.txt"
# cp "this is a bad file name as there's punctuation...txt" /some/dir
# oowriter "some other filename with spaces.odt"

----
Freddie Cash, LPCI-1 CCNT CCLP        Helpdesk / Network Support Tech.
School District 73                    (250) 377-HELP [377-4357]
fcash-ml at sd73.bc.ca





More information about the kubuntu-users mailing list