See also:

How to scp?

Using the scp command.
Code snippet

Copying files to a remote server can be accomplished with scp.


scp -r local_file

local_file will be copied to the server into remote_dir. The new file will be named remote_file.

Copying a directory

To copy a directory, use the -r (recursive) option:

scp -r local_dir

Do you want a new directory to be created inside remote_dir named local_dir or just copy the contents of local_dir into remote_dir directly?

Last updated on 3/5/2020 by Anton Vasetenkov.