You need to transfer some files to or from your server but don’t have an FTP connection available…
Use Secure Copy (SCP)!
Secure Copy (SCP) is software that enables file transfer between hosts both locally and remotely and uses Secure Shell (SSH) for authentication and data transfer.
This command downloads a file from remote to localhost.
scp user@localhost:/pathToSourceFile /pathToDestination
The second line downloads a directory from remote to localhost.
scp -r user@localhost:/pathToSourceDirectory /pathToDestination
Just reverse the source and destination to upload to a remote.
scp /pathToSourceFile user@localhost:/pathToDestination
If you are using an alternate port number, use the -P flag along with the port number. Let’s say we want to download a directory and use port 1234.
scp -r -P 1234 user@localhost:/pathToSourceDirectory /pathToDestination