scp Cheat Sheet
Copy files over SSH with the trusty file-by-file tool (and when to switch to rsync).
Networking2 sections · 12 commands
⌘K
Copying Files
8scp FILE user@host:/remote/pathUpload one file
scp -r DIR user@host:/remote/pathUpload a directory
scp user@host:/remote/FILE ./Download a file
scp -r user@host:/remote/DIR ./Download a directory
scp -P 2222 FILE user@host:Specify the SSH port
scp -i KEY.pem FILE user@host:Use a specific identity file
scp -C FILE user@host:Enable compression
scp -o ConnectTimeout=10 FILE user@host:Set an SSH option
Advanced
4scp -r FILE user@host:/path && ssh user@host 'ls'Copy then inspect on the host
scp -3 host1:FILE host2:PATHBetween two remotes via local
scp -r -- '-*.log' user@host:Files starting with a dash
scp user@host:/etc/hosts /tmp/hostsGrab a config file