Use SCP command

Here are some SCP command examples:

Copy file to a server

scp local-file.txt user@server-ip:/path/to/target-file.txt

Copy file from server to local

scp user@server-ip:/path/to/remote-file.txt . # it will download the file in the current location

Copy a file to a server using a private key and a different port

scp -i ~/.ssh/private-key -P 2222 local-file.txt user@server-ip:/path/to/target-file.txt