This is one thing that I don’t use that often but when I do I alwasy have to look for the syntax of the command on google. To avoid this step I’ve finally decided to document it in a small blog post!
If you want to copy a file from your pc to a remote machine use this command:
scp <file> <username>@<IP address or hostname>:<Destination>
This works well if you have to transfer only one file, but when a folder is involved recursion has to be used:
scp -r /folder/ <username>@<IP address or hostname>:<Destination>
And finally, to instead copy files from the remote machine to your laptop:
scp -r <username>@<IP address or hostname>:<Source> <Destination> # for example, copying "files_to_copy" to current directory scp -r firstname.lastname@example.org:/home/vince/files_to_copy/ .
This concludes the blog post about SCP. Hopefully the next time I have to use it I’ll remember the synthax or at least know where to find it!