How to copy all the data from usb to specific location on OS X using terminal

12,098

Solution 1

On OS X all usb devices are mounted under /Volumes, so

cp -R /Volumes/pendrive ~/somewhereinyourhome

As to recognise a pendrive: type (in xterm) 'df' before plugging it in, type it again afterwards. Whatever new volume shows up thats your pendrive.

Solution 2

To list all of the hard drives on your system, try this command in the OS X terminal application:

diskutil list

Solution 3

To see the name of your USB storage device you can either look at the Desktop, or list the drives in your Volumes directory:

ls -d /Volumes/*

You can then copy the files to a local directory:

cp -a /Volumes/DEVICENAME/* ~/LOCALPATH

For me the drive is usually called "NO NAME", which requires a backslash to escape the space character:

cp -a /Volumes/NO\ NAME/* ~/LOCALPATH
Share:
12,098
Faisal Ikwal
Author by

Faisal Ikwal

Updated on June 08, 2022

Comments

  • Faisal Ikwal
    Faisal Ikwal almost 2 years

    I need a command which can copy all the data from pen drive to specific location on "OS X" using terminal. And also how to recognize pen drive on OS X.

  • Amit Joki
    Amit Joki about 9 years
    Properly editing your answer with mark down syntax will help increase it's quality. You can surround your code with back ticks `