The main volume you use in Mac OS X is called “Macintosh HD” by default and this is the volume you will start in when you start up a Terminal window. You may, however, have mounted additional volumes on your OS X system and want to work with them via a Terminal window. This can be accomplished by using commands on the underlying Unix system that Mac OS X is based on. First, however, you need to know how to change to that volume in a Terminal window.
Start Terminal by clicking on the “Finder” icon on the dock at the bottom of the screen, select “Applications” from the left part of the Finder window, double-click “Utilities” in the right part of the window and then double-click “Terminal.”
List volumes by typing the “ls /Volumes” command. A list of all volumes mounted on your system will be displayed. Mounted volumes just appear as directories on a Mac OS X system and can be treated like directories with commands in a Terminal window.
Change volumes by typing "cd /Volumes/volume-name" and replacing "volume-name" with the name of the volume you want to change to.
To change to a volume, you just use the “cd” command in the same way you would use it to change directories. So if you had a volume called “Backups” you would change to it using the “cd /Volumes/Backups” command.
The “cd” command stands for “change directory.” It is then followed by a space and the directory you want to change to. If you start the directory you want to change to with a “/“ character, that means you are telling it to change to a relative to the root directory.
You could also change the volume by typing the “cd /Volumes” command and then the “cd Backups” command.
In this case the first “cd” has the “/“ character at the beginning and is relative to the root directory but the second “cd” has no “/“ character, which means it is relative to the current directory (“/Volumes” in the example above).
Escape volume names containing spaces. If a volume name has a space in it, such as “Macintosh HD” has, you need to “escape” that space properly. You can do that in two ways.
The first way is to prefix the space with a “\” character, so you would use “cd /Volumes/Mackintosh\ HD” to change to it. The second way is to surround the volume name with double quotes and use the cd /Volumes/“Mackintosh HD” command.
Find out where you are with the "pwd" command. If you have been changing volumes and directories and you want to find out where you are in your Terminal window, type “pwd” and that will show you the full path to your current directory.
Type "help cd" in a Terminal window to get a brief overview of the "cd" command.
The Terminal command line is very powerful and misuse can damage your system, so take care when entering commands.
Tips and warnings
- Type "help cd" in a Terminal window to get a brief overview of the "cd" command.
- The Terminal command line is very powerful and misuse can damage your system, so take care when entering commands.
Things you need
- Intel-based Mac OS X system.