Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    in case of a space...

    i've encountered this several times already whenever i'm using character-cell mode in Linux. you see, sometimes i just can't avoid naming files with spaces in it, as i do this in GUI mode. now whenever i don't start X, i try to go to a folder or want to open a text file, and i can't get it to open since there names contain spaces.

    so aside from renaming these files into something w/out spaces, what else can i do? i'm sure there's a work around for this in Linux. if DOS can do it with ~1 or ~2 whenever there's a space, there's no doubt Linux has a way of doing this too!
    Registered User #345074

  2. #2
    If I remember right, you simply put quotes (") around the file or directory name, space included. For example, if your directory is called /usr/my stuff/ and you want to cd into into, do:

    cd /usr/"my stuff"

    The other thing I use a lot of that is useful is the tab key for long filenames. This is an auto complete thing that prevents typos for me. Like /var/log/reallreallyreallylongcomplicatedfilenamethatIdontw antotypeallin

    do /var/log/real<Tab> and if the first few characters are unique, it automatically fills the rest in.

  3. #3
    oh, yeah! i am feeling so stupid right now! quotes does do it! one of the most common things in programming - Strings - and i ... oh hell! hahahaha...

    thanks aschueler!
    Registered User #345074

  4. $spacer_open
  5. #4

    you made my day that I could actually be the giver of instead of receiver of help, even if it was simple.

  6. #5
    Linux Engineer
    Join Date
    Dec 2002
    New Zealand
    u can also use escape characters, also known as backslash

    eg. if ur file is /home/mp3/artist - song.mp3

    type /home/mp3/artist\ -\ song.mp3

    by putting in abackspace it makes the character after the backslash into a text character and not a command space.

  7. #6
    ok,thanks guys. i just suck at this! hehe... mind you i tried placing the ASCII value of a space where a space occurs in a filename. sure enough that didn't work, but i never thought of an escape character nor of a string-literal-like way of doing it. this had me laughing the whole night, that night, when aschueler answered this post. =)
    Registered User #345074

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts