Back to practice tasks

practice task

Preview What rsync --delete Would Remove

You need to mirror a release directory to a backup target, but stale files on the target should be removed. Before running the real sync, you must preview deletions.

Independent study support only. No affiliation, endorsement, exam dumps, or guaranteed exam results.

Try first

rsync -ani --delete /srv/app/releases/current/ /backup/app/current/

Goal

Run a dry run that itemizes changes and clearly shows delete candidates.

Expected output

An itemized dry-run list. Lines beginning with *deleting identify files that would be removed from the target during the real run.

Teaches

Dry runs make destructive sync behavior reviewable before it touches files.

Common mistake

Forgetting the trailing slash distinction on rsync paths or running --delete without reviewing a dry run.

check your answer

Answer key

What should your command prove?

An itemized dry-run list. Lines beginning with *deleting identify files that would be removed from the target during the real run.

How to explain it

Dry runs make destructive sync behavior reviewable before it touches files.

What to avoid

Forgetting the trailing slash distinction on rsync paths or running --delete without reviewing a dry run.

command set

Commands to know

  1. rsync -av --dry-run --delete source/ target/
  2. rsync -ani --delete source/ target/
  3. grep '^*deleting'

answer check

Compare expected output

Open these command examples to compare your answer against realistic output.

next practice

List Failed systemd Units

After a reboot, a host is reachable but something feels broken. You need a quick inventory of failed units before digging into individual logs.