How to Send Files / Folders from Local PC to Remote Server ? (Using SCP)

How to Send Files / Folders from Local PC to Remote Server ? (Using SCP)

Most of the time, we need to send some files / folders from our local PC or laptop to a remote server or vice versa.
For this purpose, there are many tools available but in this article, I am going to tell you, how to send files to remote server using SCP (Secure Copy Protocol).


1)   Check if SCP is present in your PC / Laptop
Open Terminal, and enter "scp" and hit enter.

image.png

If you get output similar to the above image, then SCP is present in your PC / Laptop.

2)   Connect to your remote server.
Here, I am using ec2 instance. If you want to know, how to create AWS ec2 instance, check out my article.
As below image shows, there is no file in present directory currently.

image.png

3)   SCP Command in your local PC / Laptop

scp -i "server key" "filepath" "server name"@"Public IPv4 DNS":"path in your server"
scp -i 'C:\Users\ROHIT\Downloads\My First EC2.pem' C:\Users\ROHIT\desktop\test.txt ubuntu@ec2-43-205-216-142.ap-south-1.compute.amazonaws.com:/home/ubuntu

Enter the command in terminal and hit enter. image.png

4)   Your file is received in the server.

image.png

Note :=> You can also send zip file using above steps and then unzip that file in the server.


Thanks For Reading 😊