Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Eva01ars

macrumors newbie
Original poster
Oct 8, 2008
4
0
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
 
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
 
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.

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.
 
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?
 
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

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.
 
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
 
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.)
 
In most shells these days (including OSX Terminal) you can type /Volumes/Cr and hit tab. It will fill in the rest.

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.

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.)

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.
 
Don't forget the du -h command too. Nice easy way to find out where your disk space is going to :)
 
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.
 
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.

Works in Ubuntu 8.04 also.
 
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.

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>
 
bash is case-sensitive. Make sure you're typing "/V", and not "/v".
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.