SCP – Secure Copy

scp, the secure version of cp, aka copy, is pretty great, since it is straightforward to copy one or more files or directories from any one machine to any other machine (and the command could be running on a third machine).

SCP Syntax

scp (-r = recursive) (-i private key) (user@server:directory/file) or (/local/directory/file) (-i private key) (user@server:directory/file) or (/local/directory/file)

  • scp
  • optional -r for recursive directory structure
  • optional -i for optional identity file aka private key
    • Use the full path for the identity file (this file needs to be local to the machine on which scp is being run
  • either a user@server: or a /local/directory/file for the source
    • Note that there is no slash after the colon before the first directory name on a remote location
  • either a user@server: or a /local/directory/file for the destination