Mac Terminal Change to Directory on External Drive
Here is how to cd
(change directory) into an external drive using Terminal on Mac computers. The trick is knowing the name of the drive and where it is located. On Macs, all connected drives (including hidden drives) are mounted/located under the /Volumes
directory. So we can use this information to get the names of all drives:
cd /Volumes && ls
So that would look something like this when entered in Terminal:
Mac:~ username$ cd /Volumes && ls
Drive 1 Macintosh
Drive 2 Time Machine
Drive 3 com.apple.TimeMachine.localsnapshots
This gives us the information we need (the drive name) to then cd
change directory into any drive. For example, to change to the external/USB drive named Drive 1
, we can get there like this:
cd Drive\ 1
Note: In this example, because the drive name contains a blank space, we escaped it with a backslash \
.
Bonus Tip
To get more information about your connected drives, use diskutil
Disk Utility list
command:
diskutil list
Enter that in Terminal to get a load of details about each connected drive.