SCP/rsync Cheatsheet
File transfer.
Overview
scp and rsync are the standard SSH-based file-transfer tools. The cheatsheet captures the patterns operators actually use; rsync is the right default for non-trivial transfers because it is restartable, incremental, and correct under retry.
- SSH-based transfer. Both tunnel through SSH; preserves auth and encryption automatically.
- scp for simple copy. One-shot file copy; matches simple ad-hoc cases that do not justify rsync.
- rsync for sync. Incremental sync with delta transfer; handles large or repeated transfers efficiently.
- Resume support plus filtering. rsync resumes interrupted transfers; include/exclude patterns support targeted sync.
The approach
The practical approach: rsync over scp for anything non-trivial, archive mode by default, dry-run before destructive operations, explicit excludes, custom SSH options when ports are non-standard. The team’s discipline produces predictable transfers.
- rsync -avz src/ user@host:dst/. Archive, verbose, compress; the canonical sync invocation.
- rsync --dry-run. Test what would happen; catches mistakes before they delete the wrong files.
- rsync --delete. Remove files at destination not in source; produces true mirrors when that is the goal.
- rsync --exclude plus custom SSH. Include/exclude patterns for targeted sync;
rsync -e "ssh -p 2222"for non-default ports.
Why this compounds
scp/rsync fluency compounds across operations. Each transfer captures operational knowledge; the team’s automation grows; new transfers reuse the patterns.
- Faster transfers. Rsync’s delta transfer reduces bandwidth; large repeated transfers run in seconds, not hours.
- Reliable backups. Rsync handles unreliable networks; resume on failure makes long transfers tractable.
- Reusable patterns. Standard rsync invocations capture patterns; the team library compounds across the year.
- Institutional knowledge. Each rsync command teaches Unix file semantics; the team’s automation muscle grows.
scp/rsync fluency is an operational discipline that pays off across years. Nova AI Ops integrates with operations telemetry, surfaces patterns, and supports the team’s automation discipline.