Linux Commands - scp (transfer files using secure copy protocol)

Secure copy protocol (SCP) can be used to transfer a file from one Linux system to another Linux system. For example, the scp command could be used to transfer example.jpg from Machine 1 to Machine 2, or vice versa.

 

The Secure FTP (SFTP) command can be used to securely transfer files between Mac, Linux and Windows systems.

 


upload / push / PUT

In this example, example.jpg is transferred from server1 to server2.

[john.doe@server1 ~]# scp '/home/john.doe/example.jpg' jane.doe@server2:'/home/jane.doe'
example.jpg        100$ 12  0.7KB/s  00:02

 


download / pull / GET

In this example, example.jpg is transferred from server2 to server1.

[john.doe@server1 ~]# scp jane.doe@server2:'/home/jane.doe/example.jpg' '/home/john.doe'
example.jpg        100$ 12  0.7KB/s  00:02

 


Passwordless Authentication

Refer to public key authentication with OpenSSH (passwordless auth) for the steps on how to connect using a public private keypair.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter 84c42 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |