scp
Copy files between computers over SSH
What it does
scp works like cp, except one of the paths is on another machine: user@host:path. You can send a file to the server or fetch one from it by swapping the arguments: scp deploy@web-01:/var/log/app.log ..
Folders are copied with -r. The port is a capital -P, unlike in ssh. For large folders and repeated copies rsync is handier: it sends only the files that changed.
Careful. scp overwrites a file with the same name at the destination without asking.
Syntax
scp <file> <user>@<host>:<path>
scp <user>@<host>:<path> <destination>
scp -r <folder> <user>@<host>:<path>Examples
Copy backup.tar.gz to the server 203.0.113.10, into /tmp
scp backup.tar.gz deploy@203.0.113.10:/tmp/same as:
scp backup.tar.gz deploy@203.0.113.10:/tmpscp— copy over SSHbackup.tar.gz— what to copydeploy@203.0.113.10:/tmp/— where: user@server:path