How to transfer a file from a remote computer to a local machine on Linux/Ubuntu

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 transfer files in linux 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) .

Read: How to quickly send a text from Ubuntu to Android using a three-line Bash script

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.       [scp command in Ubuntu]

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


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

 

amin nahdy

Amin Nahdy, an aspiring software engineer and a computer geek by nature as well as an avid Ubuntu and open source user. He is interested in information technology especially Linux based ecosystem as well as Windows and MacOS. He loves to share and disseminate knowledge to others in a transparent and responsible way.

Leave a Reply