If your client machine (the machine you are sitting at) is called machineA and the machine you are currently SSH'ed into is called machine B. MachineA, your local machine must have SSHD running and port 22 open. Then:
scp myfile machineA:
Copies myfile
on MachineB to my MachineA home directory on machineA. This assumes userid/password are the same.
scp myfile machineA:/newdir/newname
Copies myfile
one MachineB to /newdir/newname
on machineA. This assumes userid/password are the same.
scp MachineA:/path/to/my/otherfile .
Gets a copy of otherfile
from my MachineA directory on MachineA and puts it in my current working directory on the MachineB machine (designated in standard UNIX fashion by the "dot" (.) character). This assumes userid/password are the same.
If the userid/password are not the same then use:
scp myfile user@MachineA:
to get file.
scp user@MachineA:/path/to/my/otherfile .
to put files
NOTES about SCP:
Just like the cp
command, scp
has a -p option to propagate the permission settings of the original file to the copy (otherwise the copy is made with the normal settings for new files), and a -r option to copy an entire directory tree with one command.
scp
creates a completely transparent encrypted data channel between the two machines, so binary data (such as images or executable programs) is preserved correctly. This also means that scp
is unable to perform automatic end-of-line termination conversion between different types of operating systems, as can be done with ftp in "ascii" mode. That will not be a problem when copying between Unix systems, which all use the same end-of-line convention.