If you have ever used a remote Linux server over a graphical connection tool like VNC, you’ll notice that while it is possible to copy text to and from your local machine to the server, folders and files are another different story. Sometimes, other tools like remote desktop won’t even allow you to copy text.
This can be a bummer especially when you are in a hurry but it doesn’t have to be a head-ache. Copying files to a remote Linux server is as easy as saying ‘SSH’
You simply use the scp command on terminal.
To copy a file to a remote server, you run:
$scp <filename> user@remoteip:<path to copy>
Example: $scp squiggly.txt email@example.com:~/Documents
To copy a file from a remote server, you simply run:
$scp user@remoteip:<path to file> <path to where you want to paste the file>
$scp firstname.lastname@example.org:~/Documents/squiggly.txt /home/smuggy/Downloads
To copy folders on the other hand, just add <-rp> like this:
$scp -rp squigglyfolder email@example.com:~/Documents
$scp -rp firstname.lastname@example.org:~/Documents /home/smuggy/Downloads