I sometimes need to transfer files from one computer to another using SSH and I always forget how to do it so I decided to write a short post as a reminder.
To copy a file from one computer to another we use the scp command, which is very easy to use:
1 scp file.txt <remote user>@<some domain or ip>:<remote path>
The cool thing is that you can copy from the remote computer to your local computer inverting the order:
1 scp <remote user>@<some domain or ip>:<remote path to file> /home/adrian/
Finally, if you want to copy a folder with all it’s content you need to add a -r flag.