SCP is used to copy files securely over network. In order to use SCP, the remote host must be configured to use SSH server (OpenSSH on Linux system, including Ubuntu) and the user must have an account on remote server.
scp syntax is easy,
local:~$ scp <source> <username>@<remote_host>:<destination>
Example for copying local file to the users home directory on remote host, you can replace mypapit with your own username
local:~$ scp id_rsa_.pub firstname.lastname@example.org:~/
id_rsa.pub 100% 392 0.9KB/s 00:00
To list the file on the remote directory, just run
local:~$ ssh email@example.com ls
and the content of remote directory will be displayed.
Copying file recursively
To copy file recursively, you only need to add “-r” switch. Add -v for verbose output.
local:~$ scp -rv ~/* firstname.lastname@example.org:~/backup
SCP is easy to use especially when you want to copy or upload files from client to server without the use of FTP server. Additionally, the content of the files transfered is encrypted over SSH communication and you get the benefit of simplicity while working on the console.