Shell
rsync — the file-sync commands that cover daily work
rsync for local and SSH copies: mirror directories, preview with dry-run, delete safely, and resume large transfers.
Local copy
rsync -av src/ dst/ — archive mode, verbose, sync src into dst (trailing slash matters)
rsync -av src dst/ — copies the src dir itself into dst/
rsync -avn src/ dst/ — dry run (-n)
Over SSH
rsync -av src/ user@host:/path/ — push to remote
rsync -av user@host:/path/ dst/ — pull from remote
rsync -av -e "ssh -p 2222" src/ user@host:/path/ — non-default port
Useful flags
-z — compress in transit (slow network)
-P / --progress — show per-file progress
--delete — delete files on dst not in src (true mirror — careful)
--exclude='*.log' / --exclude-from=file — skip patterns
-h — human-readable sizes
--bwlimit=10000 — cap bandwidth (KB/s)
Resumable big transfer
rsync -avP --partial src/ dst/ — partial keeps interrupted file fragments for resume