CloudsArk
Commands Linux

rsync over SSH and --delete in Linux

Learn advanced and troubleshooting-focused rsync usage for practical Linux administration.

rsync over SSH and --delete in Linux

Introduction

Advanced rsync usage helps when the basic form is not enough. This article focuses on realistic command patterns that are useful during administration and troubleshooting.

When You Need Advanced Usage

Use rsync when you need repeatable copies that transfer only differences. It is ideal for backups, deployments, and syncing directories over SSH. Advanced usage is most useful when you need to narrow scope, work on multiple targets, or diagnose why the first command did not answer the question.

Practical Examples

Inspect first:

rsync -avn source/ backup/

Run a focused command:

rsync -av --delete source/ backup/

Use a real-world pattern:

rsync -av -e ssh /srv/app/ admin@server:/backup/app/

Troubleshooting

If rsync does not give the expected result, verify the target first with rsync -avn source/ backup/. Then check permissions, paths, service state, network reachability, package repositories, or process state depending on what the command manages.

Example output:

sending incremental file list
app.conf
sent 1,024 bytes  received 64 bytes  2,176.00 bytes/sec

Common Mistakes

  • Misunderstanding the source trailing slash, which changes what gets copied.
  • Using --delete without a dry run.
  • Running as root when preserving ownership is not actually required.

Safety Notes

Use a preview, backup, dry run, read-only command, or smaller test target before applying broad, recursive, destructive, or remote operations.

Summary

Advanced rsync usage should still be controlled. Build the command step by step and verify the result separately.