transfer

How to transfer files over SSH/SCP

I often forget the syntax for getting files over a SSH connection.

scp user@address:/path/to/file /path/of/new/file

For example:

scp root@domain.com:/tmp/mysql/test.sql .

Will transfer test.sql to the current folder (.) Also, if you need to change the port, just use the -P option

scp -P 9000 user@address:/path/to/file .

If you want to transfer a file TO another server:

scp /path/of/file user@address:/path/to/new/location