With 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 firstname.lastname@example.org:/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 email@example.com:/home/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 firstname.lastname@example.org:/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 email@example.com:/home/john/index.html index.html
You can of course give the file a new name when copying them across.