rsync flags & options
-a, --archive
Archive mode. Equivalent to -rlptgoD. Preserves permissions, timestamps, symlinks, and more.
rsync -a src/ dest/
-v, --verbose
Increase verbosity. Shows files being transferred.
rsync -av src/ dest/
-z, --compress
Compress data during transfer. Useful over slow connections.
rsync -avz src/ user@host:/dest/
-P
Combines --progress and --partial. Shows progress and keeps partial transfers for resume.
rsync -avP largefile.tar.gz user@host:/data/
--delete
Delete files in the destination that don't exist in the source. Makes dest an exact mirror.
rsync -av --delete src/ dest/
--exclude
Exclude files matching a pattern.
rsync -av --exclude="node_modules" --exclude="*.log" src/ dest/
--dry-run, -n
Show what would be transferred without actually doing it.
rsync -avn src/ dest/
-e
Specify the remote shell to use. Commonly used to pass SSH options.
rsync -avz -e "ssh -p 2222" src/ user@host:/dest/
--include
Include files matching a pattern. Used with --exclude for fine-grained control.
rsync -av --include="*.js" --exclude="*" src/ dest/
-r, --recursive
Recurse into directories. Already included in -a.
rsync -rv src/ dest/
--progress
Show transfer progress for each file.
rsync -av --progress src/ dest/
-u, --update
Skip files that are newer on the destination.
rsync -avu src/ dest/