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, Mac OS and Windows. On Windows 10 and higher it can be used with e.g. PowerShell or Windows-Terminal.

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