Transferring files with SCP

Transferring files with SCP

SCP stands for Secure Copy Protocol it's based on SSH which allows us to access the remote system over the secure connection. The Good thing about SSH is we can connect to the remote system and execute the commands.

Copying files from Local Machine to Remote Server with SCP

This is really helpful when you have to copy any files from the local machine to the remote server or vise versa. If you love GUI you can use programs like Filezilla to copy the files over the FTP.

Copying files in the Terminal with SCP is really easy.

All you have to do is Open the terminal can enter the command.

scp /home/letsfoss/myfolder root@SERVER-IP:/var/www/folder

The above command is for copying the folder contents from the local machine to the remote server.

Let's break down the command.

  • scp is the program which helps to perform the file copying operation.
  • /home/letsfoss/myfolder is the local folder which I want to copy into the server
  • root@SERVER-IP root is my SSH username and SERVER-IP is the actual server IP
  • :/var/www/folder This is the path on the remote server where I want to copy all the contents from the local machine.

Once you have all the information, press the Enter key and you'll be prompted with a password input.

Enter your password and press enter key to start copying from the local machine to the remote server with SCP.

Get Free updates about Linux on Telegram
We send Linux Memes, Articles and Open Source projects. No Random Spam Links. Click to Join

Copying files from Remote Server to Local Machine with SCP

For transferring the files from the remote server to the local machine we have to alter the command a bit.

scp root@SERVER-IP:/var/www/myapp /home/letsfoss/myapp

When transferring the files from a remote server to the local machine we have to specify the server IP in the first argument and the local path in the second argument.

Break down of the above command

  • scp - Program which allows us to securely transfer the files
  • root@SERVER-IP - Actual SSH username and Server IP
  • /var/www/myapp - Path of the folder or file in the remote server
  • /home/letsfoss/myapp - Path of the folder or file in the local machine

Make sure you have : colon in between the server IP and server folder path

If you have any doubts, feel free to comment below.


Managing Systemd in Linux
Systemd helps us to keep & managing the services in easy way or keep the services running or start on boot. This article contains the commands which will help you to manage systemd services.
How to Generate Password in Linux
There are a ton of Password generators out there, In both online and offline. But you can easily generate strong passwords in your Linux terminal.
Fix Live USB EFI\BOOT\mmx64.efi not found
Have you tried Install Ubuntu or Any other Linux distro from USB and fails with the following error. Failed to open \EFI\BOOT\mmx64.efi - Not Found Failed to load image \EFI\BOOT\mmx64.efi: Not Found Failed to start MokManager: Not Found Something has gone seriously wrong: import_
Fix: Temporary failure in name resolution
Problem: Suddenly, I’m got DNS failure issue in Google Chrome. I tried to ping Google from Terminal Here is the error I got. ninja@softinttech:~$ ping google.com ping: google.com: Temporary failure in name resolution Here is the Fix for this issue. Open the Terminal and Run the following