rsync: The Most Powerful File Sync and Backup Tool for Linux
rsync explained with the options you’ll actually use: local and remote syncs over SSH, mirroring, exclusions, incremental backups, cron jobs and deploys.
In my previous article, I covered Robocopy, one of the most reliable file copy and directory mirroring tools for Windows users. Robocopy is excellent in Windows environments, but it is not available on Linux. Linux has its own native tool that offers even more flexibility, speed and control. That tool is rsync.
rsync is the standard tool for file synchronization and backup automation on Linux, across servers, cloud instances and local machines. It transfers only the changed blocks of a file, preserves permissions, ownership and timestamps, and works locally or over SSH, which is why system administrators and DevOps engineers use it for backups and deploys.
This article explains rsync in detail, gives practical examples, and shows why it is the preferred option on Linux.
What is rsync?#
rsync is a command line utility that synchronizes files and directories between two locations. It can work locally or over a remote connection using SSH.
Key capabilities include:
- Delta-based file transfer
- Fast, bandwidth-efficient syncing
- Preserved metadata: permissions, ownership, timestamps and symlinks
- Secure remote transfer over SSH
- Directory mirroring
- Exclusions and pattern-based filtering
- A natural fit for cron-based backups and automation
Why is rsync so popular?#
rsync is popular because it transfers only changed blocks, handles interruptions, encrypts transfers over SSH, fits into cron jobs and scripts, and runs on Linux, Unix, macOS and WSL.
1. Efficient#
Only the changed blocks of a file are transferred, which saves time and reduces network usage.
2. Reliable#
rsync handles interruptions and preserves all metadata accurately.
3. Secure#
It uses SSH for encrypted file transfer.
4. Automation friendly#
Perfect for cron jobs, scripts, deployment pipelines and server maintenance tasks.
5. Cross platform#
Available on Linux, Unix, macOS and WSL.
What is the basic rsync syntax?#
The basic rsync syntax is options, then the source, then the destination.
Example:
This copies all files from docs to backup/docs with their original permissions preserved.

What do the common rsync options do?#
| Option | What it does |
|---|---|
-a | Archive mode, which preserves metadata |
-v | Verbose output |
-z | Compression during transfer |
-h | Human-readable numbers |
--delete | Remove files at the destination that are not in the source |
--exclude | Exclude patterns or folders |
--progress | Show detailed progress |
-e ssh | Force rsync to use SSH |
Practical rsync Examples#
Most everyday rsync commands are -av plus one or two options: -e ssh for remote servers, --delete for mirrors, --exclude for filters, --progress for progress and --link-dest for incremental backups.
1. Copy files locally#
2. Sync files to a remote server via SSH#
3. Download files from a remote server#
4. Mirror a directory#
Note: --delete removes files from the destination that do not exist in the source.
5. Exclude files or directories#
6. Show transfer progress#
7. Incremental backup using rsync#
Advanced rsync Techniques#
Advanced rsync use covers daily backups with cron, resumable syncs over slow networks with --partial, and deployments that exclude folders like node_modules.
1. Automating daily backups with cron#
Add:
This runs every day at 2 AM.
2. Syncing data over slow or unstable networks#
--partial keeps partially transferred files so the sync can resume later.
3. Using rsync for deployments#
Frequently asked questions#
What does rsync --delete do?
--delete removes files from the destination that do not exist in the source. Combined with -av, it turns the destination into a mirror of the source.
What does rsync -a mean?
-a is archive mode, which preserves metadata such as permissions, ownership, timestamps and symlinks. It is usually paired with -v for verbose output.
How do I use rsync over SSH?
Add -e ssh and give the remote side as user@host:/path, for example rsync -av -e ssh /var/www/ user@192.168.1.10:/backup/www/. Swap the source and destination to download from the server instead.
Can rsync resume an interrupted transfer?
Yes. --partial keeps partially transferred files so the sync can resume later, which helps on slow or unstable networks.
How do I make incremental backups with rsync?
Use --link-dest pointing at the previous backup, for example rsync -av --link-dest=/backup/daily.1 /data/ /backup/daily.2.
Conclusion#
Robocopy is the ideal solution for file synchronization on Windows, but rsync is the real powerhouse on Linux. It delivers excellent performance, secure transfers through SSH, and precise control over every part of file replication. Whether you are managing servers, running backups or automating deployments, rsync is the tool you will rely on.
Written by Dhananjay Aggarwal


