To learn how copy a file from another machine or how to transfer files between two computers, you can use the scp utility. In this short tutorial you will see how to achieve this using simple commands.
To send a file from your computer to a remote machine, run the command below:
scp /file_to_send_path user_name@remote:/destination_folder_path
Where the remote can be an IP address or an FQDN( fully qualified domain name such as sub_domain.example.com) .
if however you are want to receive a file from a remote computer:
scp user_name@remote:/file_to_send /destination_folder_path
scp allows also to send files between two remote machines using the syntax below :
scp user_name@source:/file_location user_name@destination:/destination_folder_path
For instance :
scp user_name@remote_1:/file_to_send user_name@remote_2:/destination_folder_path
For more details about scp, read our article: How to use scp command to transfer files securely using ssh on Linux