Syntax for Secure Copy (scp) Linux

SCP allows files to be copied from one host to another over SSH.

Copy the file “foobar.txt” **from the REMOTE HOST to the LOCALHOST**
scp username@remote-host-ip:foobar.txt /home/ranzy/Desktop/
Copy the file “foobar.txt” **from LOCALHOST to the REMOTE HOST**
scp /home/ranzy/Desktop/foobar.txt username@remote-host-ip:
 Don’t forget the **:** after the remote-host-ip as this represents the root directory of the remote host. If you wanted to transfer foobar.txt to the /var/www/html directory you would have *username@remote-host-ip:/var/www/html*