April 21, 2021



Linux – SCP to download, upload or copy files

edit-copy-iconWith several Linux computers or servers it can be useful or practical to copy files from one computer to another from the terminal directly. We use a command called SCP to do it. And here is how to:

To copy a file from your local system to a remote system.
scp file user@host.domain:/path
Example: I want to copy the file index.html from my current directory to my home folder on a remote machine.
scp index.html john@

To “download” or copy a file from a remote system to your local system.
Note the space between the path and file, if you want to keep the same name you can replace the file with a .(dot)
scp user@host.domain:/path file
Example: I did some changes on the remote machine index.html file and I want to copy it back to my system.
scp john@ index.html

You can of course give the file a new name when copying them across.

That’s it.
Happy copying!