Copy files from and to server using SCP

When you are working with remote Linux system or server, you might want to download some files from the machine to your machine, or you may want to copy some files from your machine to the remote machine.

Image source

Always, there is possibility that you can upload the file to some site and later download to other machine from the site. But Linux has an easy option to copy files form or to server — SCP — that’s Secure Copy.

Secure copy protocol is a means of securely transferring computer files between two hosts.

To copy a file from remote machine to your local machine, use command as below:

scp user@host:/home/user/abc.zip ~/Documents/

To copy any files from your local machine to remote host, use the below command:

scp /home/user/abc.key user@host:/home/user/

If you are using a different port for SSH/SCP specify with -P as below:

scp -P 5412 ...

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store