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

Related commands

Practise · All commands