Mac Terminal SSH file transfer?

Is there a way to transfer files directly from a Mac to another using only Terminal? Perhaps using SSH?

asked May 19, 2011 at 20:10 1,392 9 9 gold badges 29 29 silver badges 39 39 bronze badges

4 Answers 4

Yes, you can use scp , which basically cp over ssh. It can work either way also, so:

scp ~/Document/Localfile remoteuser@remotemachine:~/Desktop 
scp remoteuser@remotemachine:~/Destkop/remotefile ~/Desktop 

The first command would copy a file to the remote machine, the second would copy a file from the remote to the local. The syntax is @: you can do a man scp for more switches and options

answered May 19, 2011 at 20:15 Ryan Gibbons Ryan Gibbons 766 6 6 silver badges 12 12 bronze badges No problem, please remember Gordon Davisson info below wrt Mac Metadata and the -E option Commented May 19, 2011 at 20:45 Remember to use scp -r to copy entire folders/dirs Commented Jun 29, 2022 at 3:37

The scp command on Linux is how you do file transfers using SSH

231k 71 71 gold badges 622 622 silver badges 603 603 bronze badges answered May 19, 2011 at 20:12 CenterOrbit CenterOrbit 2,046 13 13 silver badges 11 11 bronze badges

scp works great on Macs with one caveat: if you want it to copy Mac-specific file metadata (resource forks, extended attributes, etc), be sure to use its -E option.

Commented May 19, 2011 at 20:17

Here is quick way of copying files using uuencode/uudecode and clipboard.

In terminal, while having connection opened on remote machine:

press CMD + K to clear the window clear; uuencode filename < file 

Then select and copy all text from the terminal window (CMD + A, CMD + C). Now open new terminal window, on your local system and do:

uudecode 

Now press CMD + V now to paste uuencoded content of your file. Press CTRL + D after that to finish input to uudecode program. uudecode will create your file locally, under the name 'filename'.