scp (secure copy) is a command-line tool for copying files between machines over SSH.
It uses the same authentication and encryption as ssh, so no extra setup is needed beyond SSH access.
The general syntax of scp is:
scp [options] source destination
Either source or destination (or both) can be remote.
A remote path is written as:
user@host:/path/to/file
If user@ is omitted, the current local user is assumed.
scp /path/to/local/file.txt user@remote_host:/path/to/remote/directory/
If the destination is a directory, the file is copied into it.
If the destination file name does not exist, it will be created.
If it exists, it is overwritten without warning.
scp user@remote_host:/path/to/remote/file.txt /path/to/local/directory/
If the local target is a directory, the original file name is preserved.
By default, scp only copies files. To copy directories, use the -r option:
scp -r results/ user@remote_host:/path/to/remote/directory/