scp example

Example 1: scp send file

scp ./file.txt remote_username@remote_ip:/remote/directory

Example 2: scp file

scp [source file] [destination]
scp file.txt user@ip:/Desktop/

For directories, add the -r tag
scp -r [source dir] [destination]
scp -r dir/ user@ip:/Desktop/

Example 3: using scp

scp remote_username@10.10.0.2:/remote/file.txt /local/directory

Example 4: scp use

sudo scp -i "key.pem" file.txt ubuntu@10.10.0.2:myfolder/

Example 5: scp examples

# With ssh key, verbose, and -r for whole directories.
scp -v -i [your private key path] -r /my_dir [server_user]@[serverIP]:/where/to/copy

Tags:

C Example