Cheatsheet Pages / SSH Cheatsheet

How to copy files with scp — both directions, custom ports, whole directories

A tarball goes up, a log file comes down — or a whole directory tree needs to move.

Every flag and config keyword was checked against the OpenSSH 9.6 man pages, and the config examples were parsed for real with ssh -G.

scp ./app.tar.gz deploy@example.com:/tmp/         # upload
scp deploy@example.com:/var/log/app.log ./         # download
scp -P 2222 -r ./site/ deploy@example.com:/var/www/
# ⚠️ scp's port flag is CAPITAL -P; ssh uses lowercase -p.
# This mix-up is the #1 reason "scp works but ssh doesn't" (and vice versa).

Good to know

scp's port flag is CAPITAL -P; ssh uses lowercase -p. This mix-up is the #1 reason 'scp works but ssh doesn't' (and vice versa).

SSH Cheatsheet one-page card — commands that actually work
The full one-page card — SSH Cheatsheet. Get the complete cheatsheet on GitHub