how to cd into a thumb drive from terminal ( Mac OSX )
Andrew Mclaughlin How do i change into the directory of my thumbdrive? I've been poking around and see that this command, "diskutil list", lists all my local disks. That produces this..
David-Adamss-MacBook-Pro:~ davidadams$ diskutil list
/dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *250.1 GB disk0 1: EFI 209.7 MB disk0s1 2: Apple_HFS Macintosh HD 249.7 GB disk0s2
/dev/disk3 #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *4.0 GB disk3 1: DOS_FAT_32 THUMBDRIVE 4.0 GB disk3s1now i see that my thumbdrive is showing up in /dev/disk3 but i can't get to it. I can cd into /dev but thats as far as i can get.
"cd /dev/disk3/THUMBDRIVE" tells me "-bash: cd: /dev/disk3/THUMBDRIVE: Not a directory"
any help would be great.
15 Answers
# cd /Volumes && lsIt will show you the directory location of all mounted volumes. Then just cd into the drive you want.
Mac OS X mounts drives automatically under /Volumes.
mress:10042 Z$ diskutil list
/dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *1.0 TB disk0 1: EFI 209.7 MB disk0s1 2: Apple_HFS mress HD 999.9 GB disk0s2
/dev/disk1 #: TYPE NAME SIZE IDENTIFIER 0: Apple_partition_scheme *1.0 TB disk1 1: Apple_partition_map 32.3 KB disk1s1 2: Apple_HFS mress™ 1.0 TB disk1s3
/dev/disk2 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *1.5 TB disk2 1: EFI 209.7 MB disk2s1 2: Apple_HFS Development 512.2 GB disk2s2 3: Apple_HFS Media 987.7 GB disk2s3
mress:10043 Z$ ls /Volumes
Development/ Media/ mress HD@ mress™/You'll notice the directories match the NAME column.
In Terminal, if you
ls /Volumesyou'll see all of your drives. You can then cd to one of them (or just cd directly - no need to list the volumes first). For example:
cd /Volumes/My\ Other\ DriveSpaces are replaced by '\ '. Or you can put the whole thing in quotes:
cd /Volumes/"My Other Drive"If the drive name has no spaces, then you'd just use the name:
cd /Volumes/MyOtherDrive If you drag and drop the icon corresponding to the volume on the USB drive from the Desktop (or Finder) into the Terminal window, it will automatically paste the path where that volume is mounted. This will most likely be a path in /Volumes.
ypuou have to mount it first.
#mkdir /media/myusbstick
#mount /dev/disk3 /media/myusbstick
# cd /media/myusbstickmake a directory, then mount then cd into it
You need to be root to do this, there are ways to set it up so users can mount like common GUI's do, but that is beyond me
EDIT: sorry you tagged your post with linux,?? but you have a mac? This is for linux, if you were curious