How to access an external drive

I plug in a flash drive to my USB port. How can I access it through bash?

($ cd / takes me to the directory called Macintosh HD, but through Finder, I can go up one more directory called <myname>'s MacBook Pro. However,

$ cd /
$ cd ..

doesn't allow me to go to the directory <myname>'s MacBook Pro.) How can I get to the files on my flash-drive?


All volumes on internal or external hard disks/thumb drives/DVDs etc. are mounted to the directory /Volumes by default. The boot volume itself is linked as a soft link here.

Example:

user$ cd /Volumes/
...
dr-xr-xr-x   2 user      admin  -     12936 23 Nov 16:45 Audio-CD
drwxrwx---  14 user      admin  -       544 27 Okt 09:43 ExternalDrive
lrwxr-xr-x   1 root      admin  -         1 23 Nov 07:59 MacintoshHD -> /
drwx------   1 user      staff  -       296 21 Nov 07:56 NetworkShare
drwxrwx---  14 user      admin  -       544 14 Okt 16:22 ThumbDrive
...

To access your thumb drive you have to enter cd /Volumes/name_of_thumb_drive.


The above answer by @klanomath is absolutely correct. I tried to add this as a comment, but the markdown code parsing didn't like it.

The following bash command lists the external drives you currently have mounted.

mount | egrep `diskutil list | grep external | awk '{print $1}' | tr '\n' '|' | sed -e 's/|$//' | sed -e 's#|#\\|#'` | awk '{print $1 " -> " $3}'

On my Macbook with two flashdrives plugged in I get:

/dev/disk3 -> /Volumes/XXXXX
/dev/disk5 -> /Volumes/YYYYY