Data Transfer/SCP

From bwHPC Wiki
Jump to navigation Jump to search


SCP is a network protocol used for simple copy operations. It builds on ssh and usually works on every machine, that you can connect to via ssh.


Installation

SCP is already included in Linux and Mac. On Windows 11 and updated Windows 10 versions it can be used with the PowerShell.

Usage

If you want to compress your files, use the -C option.
To preserve date and time use the -p option.

# copy local file to home directory
> scp myfile <username>@<remotehost>: 

# copy local directory to home directory
​​​​​​​> scp -r mydirectory <username>@<remotehost>:

# copy local file to subdirectory
> scp myfile <username>@<remotehost>:/some/remote/directory 

# copy remote file to local directory
> scp <username>@<remotehost>:/some/remote/directory myfile