SSH command to copy a file from a remote server to a local machine

Linux Terminal iconMany of you use this command on a daily basis but some developers need to know this little line of text just for some projects where they may use SHH to move files between servers.
I usually have this information saved somewhere on my Google Drive and use it only when I need to move files with SSH.

The scp syntax

The basic syntax is:

scp username@source:/location/of/file username@destination:/where/to/file

If you are on the terminal of the computer from which you want to send file to a remote computer:

scp /file/to/send/to/remote/computer username@remote:/where/to/put/the/file

The @remote can be a fully qualified domain name or an IP adress.

If you are on the computer wanting to receive file from a remote computer:

scp username@remote:/file/to/send /where/to/put/local/HD

For a complete guide please consult the scp man