Terminal command for OS X

Discussion in 'macOS' started by Eva01ars, Mar 5, 2010.

  1. Eva01ars macrumors newbie

    Joined:
    Oct 8, 2008
    #1
    Simple request and for some reason my google-fu is failing me. How do I change the volume (drive not audio) in the Terminal app in OS X. I am using SL.

    Eva01
     
  2. Cinder6 macrumors 6502

    Cinder6

    Joined:
    Jul 9, 2009
    #3
    Code:
    ls /Volumes
    Will show you all your mounted volumes.
     
  3. Eva01ars thread starter macrumors newbie

    Joined:
    Oct 8, 2008
    #4
    cd is to change directory. It does not change Volume.

    ls Volume only lists the Volume. I want to change to another volume aside from the default to change a file in Terminal.

    Eva01
     
  4. Nugget macrumors 65816

    Nugget

    Joined:
    Nov 24, 2002
    Location:
    Houston Texas USA
    #5
    I've read this three times now and I have no idea what exactly you're asking to do. What does "change to another volume" mean to you? A "volume" isn't really a concept that even exists at the command-line.

    cd /Volumes/NAME_OF_DRIVE is almost certainly what you want, and "ls /Volumes" gets you half way there.
     
  5. spinnerlys Guest

    spinnerlys

    Joined:
    Sep 7, 2008
    Location:
    forlod bygningen
    #6
    Volume name: ferguson

    command: cd /volumes/ferguson

    And I don't even use Terminal.



    PS: What about volumes with spaces between their name? Like Craig Ferguson?
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #7
    You are confusing Windows with a Unix based system like OSX. There is no A: B: C: in Unix: all volumes are mounted into the same unified system. On OSX all volumes mounted subsequently to the root volume are mounted into /Volumes. So for example if I mount Volume myNewVolume the command cd /Volumes/myNewVolume will change to that volume.
     
  7. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #8
    You're going to have to use cd to get to wherever the file you want is located.
     
  8. hakuryuu macrumors 6502

    Joined:
    Sep 30, 2007
    Location:
    Lomita, CA
    #9
    cd /Volumes/Craig\ Ferguson/
     
  9. Queso macrumors G4

    Joined:
    Mar 4, 2006
    #10
    In most shells these days (including OSX Terminal) you can type /Volumes/Cr and hit tab. It will fill in the rest.
     
  10. Eva01ars thread starter macrumors newbie

    Joined:
    Oct 8, 2008
    #11
    Nugget and spinnerlys got me the answer I needed. I didn't know I had to put /Volumes in front of the CD and then the volume name after that.

    Eva01
     
  11. jtara macrumors 65816

    Joined:
    Mar 23, 2009
    #12
    You're taking a poor approach to learning the OSX command shell (NOT the Terminal application, which simply serves to execute a command shell in a window).

    You really need to learn some basic principles of the shell command language and how OSX file systems are organized. Any intro or comprehensive OSX book (I like "Mac OS X Snow Leopard, the Missing Manual") will give you this.

    When you state "I didn't know I had to put /Volumes in front of the volume name" you are telling me that you still don't get it.

    The right question would have been "where are volumes conventionally mounted in the file system?"

    Volumes do not HAVE to be mounted under /Volumes, or, indeed, mounted at all. If you want to access a volume that's been mounted elsewhere (because you mounted it manually, or because some program mounted it somewhere else - for example, as may be with some programs that mount remote file systems) you won't necessarily be using either /Volumes or the volume name in the cd path. If the volume is not mounted, you will need to mount it first.

    If you don't know what that means, you should go back and do some basic reading about OSX.

    The "cd" command simply allows you to move around in the file system.

    You may find the "df" command useful. "df -h" will list all mounted volumes, their mount points in the file system, and the amount of space used and free on each volume. (The -h tells it to give the numbers in "human" terms, like megabytes or gigabytes. Otherwise it reports in blocks, which is a fairly meaningless term to most people.)
     
  12. hakuryuu macrumors 6502

    Joined:
    Sep 30, 2007
    Location:
    Lomita, CA
    #13
    Yeah, but it still fills in as I typed it. And in situations like I have where I have a pair of drives named Mac 2 and Mac 3 I have to type cd /Volumes/Mac\ 3/ if I want that specific disk.

    And in OS X most volumes are mounted in /Volumes by default. Be that network (SMB, anyways) shares, disk images or volumes on locally attached disks. If this were Linux then it would be different.
     
  13. Queso macrumors G4

    Joined:
    Mar 4, 2006
    #14
    Don't forget the du -h command too. Nice easy way to find out where your disk space is going to :)
     
  14. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #15
    For what it might or might not be worth, a useful little trick that OS X offers is that you can drag a file or folder into the Terminal window, and it will result in the full path / name being inserted at the caret point.
     
  15. Steve-M macrumors regular

    Joined:
    Jun 12, 2009
    #16
    Works in Ubuntu 8.04 also.
     
  16. mkrishnan Moderator emeritus

    mkrishnan

    Joined:
    Jan 9, 2004
    Location:
    Grand Rapids, MI, USA
    #17
    I don't think very many Ubuntu users would be asking the question in this thread. :eek: :D
     
  17. Hal Itosis macrumors 6502a

    Hal Itosis

    Joined:
    Feb 20, 2010
    #18
    Not really... all you have to do is hit tab again, and it will fill in the next possible match. :)

    cd /v<tab>m<tab><tab>
     
  18. Steve-M macrumors regular

    Joined:
    Jun 12, 2009
    #19
    Perhaps, but then again, we all started somewhere. :)
     
  19. hakuryuu macrumors 6502

    Joined:
    Sep 30, 2007
    Location:
    Lomita, CA
    #20
    True enough, I have just become accustomed to doing it the typing way I guess.
     
  20. mysterytramp macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #21
    Is this an SL enhancement? It's not working for me in Leopard

    mt
     
  21. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #22
    No, it is to do with the shell you are using. Leopard might use an old version of Bash or it may not be configured correctly. Either compile a new version of Bash and change to that as your default shell or correct the configuration of your current shell.
     
  22. Cinder6 macrumors 6502

    Cinder6

    Joined:
    Jul 9, 2009
    #23
    bash is case-sensitive. Make sure you're typing "/V", and not "/v".
     
  23. RaceTripper macrumors 68030

    Joined:
    May 29, 2007
    #24
    Works in Windows too. Has for as long as I can remember.
     
  24. Hal Itosis macrumors 6502a

    Hal Itosis

    Joined:
    Feb 20, 2010
    #25
    That (default) behavior is not engraved in marble, and can instantly be changed via:

    bind 'set completion-ignore-case on'

    Enter that text on the command line to affect the current session, or put it in one of bash's init files (e.g., ~/.bashrc) to make it permanent. I highly recommend the latter.
     

Share This Page