Skip to content

Instantly share code, notes, and snippets.

@TopekoX
Created February 4, 2025 16:42
Show Gist options
  • Save TopekoX/25206549c3d91bb81aff5aab39752516 to your computer and use it in GitHub Desktop.
Save TopekoX/25206549c3d91bb81aff5aab39752516 to your computer and use it in GitHub Desktop.
Copy file to server use scp
options Description
-i identity file: Selects the file from which the identity (private key) for public key authentication is read. This option is directly passed to ssh.
-P port: Specifies the port to connect on the remote host.
-p Preserves modification times, access times, and modes from the original file.
-q Disables the progress meter.
-r Recursively copy entire directories.
-s Name of program to use for the encrypted connection. The program must understand ssh(1) options.

More command info:

man scp

Local to Remote Server

scp test.txt [email protected]:/home/ucup

Remote Server to Local

scp [email protected]:/home/jayesh/test1.txt 

Remote with private key

scp -i ~/.ssh/the-key.pem file.txt [email protected]:/home/ucup

Source: https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment