Topic
4 replies Latest Post - ‏2012-12-29T14:12:47Z by ishields
SystemAdmin
SystemAdmin
2364 Posts
ACCEPTED ANSWER

Pinned topic command line confusion

‏2012-12-29T01:55:40Z |
I am a newbie to Linux, attending a community college, and this last semester took a Linux class that was less than helpful, now I have to prepare for the LPI 101 and 102 exam and when I came across this site felt a wave of relief because I have already learned more from this site than I did the whole semester of my Linux class, but there is still something I just can't figure out and I hope someone can throw this old dog a bone. When I am working from the command line and mount my external hard drive, mounting works fine but the dirctory that it is mounted under /media/Seagate External Drive ( the name of the label ) I cannot access it and I believe it is because of the spaces, the mount command shows that it is there but the cd command says no such file or directory exist, however when I mount my LaCie drive /media/LaCie I have absolutely no problems, is there a trick to working with the spaces in the cd command?
Updated on 2012-12-29T14:12:47Z at 2012-12-29T14:12:47Z by ishields
  • SystemAdmin
    SystemAdmin
    2364 Posts
    ACCEPTED ANSWER

    Re: command line confusion

    ‏2012-12-29T04:09:55Z  in response to SystemAdmin
    I just couln't let it go, I kept searching until I answered my own question. For anyone who might be interested, when accessing a directory from the command line that has spaces in it you use single quote marks(') an example using my original question is ...cd /media/'Seagate External Drive'. another example is a sub directory of my external hard drive called my documents....cd /media/'Seagate External Drive'/'my documents'.
  • ishields
    ishields
    988 Posts
    ACCEPTED ANSWER

    Re: command line confusion

    ‏2012-12-29T05:19:27Z  in response to SystemAdmin
    You can use either single (') or double (") quotes. You can also use a backslash to excape the blanks. For example:
    /media/Seagate\ External\ Drive

    You'll also find tab completion handy. Just type
    cd /media/Sea
    and press tab and the name will be automatically expanded to
    /media/Seagate\ External\ Drive/
    If the partial name you have typed so far is not unique, press tab again to see a list of choices.

    Ian Shields
    • SystemAdmin
      SystemAdmin
      2364 Posts
      ACCEPTED ANSWER

      Re: command line confusion

      ‏2012-12-29T06:35:06Z  in response to ishields
      Thanks for the added info, I really like Linux and I'm using it full time now so every little bit helps. thanks again.
  • ishields
    ishields
    988 Posts
    ACCEPTED ANSWER

    Re: command line confusion

    ‏2012-12-29T14:12:47Z  in response to SystemAdmin
    If you haven't already found it you might also find our article "Learn Linux, 101: The Linux command line" (http://www.ibm.com/developerworks/library/l-lpic1-v3-103-1/) useful. It's part of our "Learn Linux, 101: A roadmap for LPIC-1" series (http://www.ibm.com/developerworks/linux/library/l-lpic1-v3-map/).

    Ian Shields