rsync trailing slash Explained¶
Introduction¶
This article explains a common rsync usage that administrators and learners often need to understand clearly.
What This Command Means¶
The command performs this specific task with rsync:
rsync -av app/ backup/app/
Breaking Down the Command¶
rsyncis the command being run.- The options or arguments decide the behavior.
- The final value is the target, such as a file, process, service, package, host, URL, or directory.
Practical Examples¶
rsync -av app/ backup/app/
rsync -av /srv/app/ /backup/app/
rsync -avn source/ backup/
Example output:
sending incremental file list
app.conf
sent 1,024 bytes received 64 bytes 2,176.00 bytes/sec
When to Use It¶
Use rsync when you need repeatable copies that transfer only differences. It is ideal for backups, deployments, and syncing directories over SSH.
Common Mistakes¶
- Misunderstanding the source trailing slash, which changes what gets copied.
- Using
--deletewithout a dry run. - Running as root when preserving ownership is not actually required.
Safer Alternatives¶
Inspect before changing state when possible:
rsync -avn source/ backup/
For wider changes, test on a small target before using the command broadly.
Related Guides¶
Summary¶
Understanding rsync trailing slash is about knowing what each part does and checking the final state after running it.