Linux Commands - scp (transfer files using secure copy protocol)
by
Jeremy Canfield |
Updated: October 18 2022
| Linux Commands articles
On a Linux System, the most popular ways to transfer a file from one Linux system to another Linux system are:
- scp (Secure Copy Protocol) (this article)
- rsync (Remote Sync)
- wget (download files from an HTTP web server)
For example, scp or rsync 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.
Did you find this article helpful?
If so, consider buying me a coffee over at