Rsync is the standard tool for fast, incremental file transfer and synchronization on Linux and macOS. It copies only what has changed, making it very efficient for backups.

Basic Syntax

rsync -avz source/ destination/

Sync to a Remote Server

rsync -avz -e ssh /local/path/ user@server:/remote/path/

Dry Run (Preview Changes)

rsync -avzn source/ destination/

Exclude Files

rsync -avz --exclude="*.log" --exclude="node_modules/" source/ destination/

Delete Files Removed from Source

rsync -avz --delete source/ destination/