Copy and Sync Files with rsync

rsync copies over SSH, skips unchanged files, resumes interrupted transfers, and preserves permissions and timestamps.

LinuxbackupcopyrsyncLow risk
Run `rsync -avh --progress source/ user@host:/dest/` to sync a directory's contents to a remote host over SSH.

01Command

Command
$ rsync -avh --progress source/ user@host:/dest/

02What it does

The single most forgotten rule: a trailing slash on the source means 'copy the contents', while no slash means 'copy the directory itself' — this one character decides the destination layout. Add `-n` (dry-run) plus `--delete` to preview exactly what a mirroring sync would remove before committing to it. Re-running the same command transfers only differences, which is why rsync doubles as a backup tool; interrupted transfers resume with `--partial`.

03Risk

RiskLow risk
Requirementsrsync installed on both ends (default on most distros)
!Warning: --delete mirrors the source exactly and will delete files at the destination that vanished from the source — always preview with -n first.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • rsync(1) - Linux manual page
    Ubuntu Manpages · technical · 2026-09-17
    Evidence: rsync is a fast, versatile file copying tool; a trailing slash on the source copies the contents of the directory rather than the directory itself, and --delete deletes extraneous files from the destination.

Last verified: 2026-09-17 · Category: Files & Folders