SCP - Secure Copy

SCP allows file to be copied to, from, or between different hosts using ssh for data transfer.

Copy files from remote computer to a local computer:

$ scp username@www.xzy.com:~/somefile.txt /home/local/directory

Copy files from local computer to remote computer:

$ scp /home/local/directory/somefile.txt username@www.xzy.com:~/

Copying a directory
Copy a directory 'dir' from local computer to remote computer

$ scp -r /home/local/dir username@www.xzy.com:~/

Using a specific cipher
SCP uses Triple-DES by default. To change cipher, use the following command:

$ scp -c blowfish username@www.xzy.com:~/somefile.txt /home/local/directory

Using a port other than 22
By default scp is configured to used port 22. If you a different port for secure shell, e.g. 7822, you would get the following error message:

ssh: connect to host some_site port 22: Connection refused
lost connection

To specify a different port, you need to use the -P option. To copy files from local computer to remote computer:

$ scp -P 7822 phyml_v3.0.tar.gz username@xyz.com:~/

To copy files from remote computer to local computer:

$ scp -P 7822 username@xyz.com:~/somefile.txt /home/local/directory