World map

 

BM: Baca dalam Bahasa Melayu

World L4: Remote Kitchens

Copy files: scp and rsync

You will learn: to send files to a server, and to send only what changed.

Checked with Linux (Debian 13) on 1 Nov 2026

The problem

laptop (lab)
rsync -av site/ kedai:shop/
sending incremental file list
./
menu.html
sent 186 bytes received 44 bytes 460.00 bytes/sec
total size is 58 speedup is 0.25
rsync -av site/ kedai:shop/ after one change: only menu.html travels.

You changed one price on the menu. Only menu.html travelled. The other files stayed put. How did it know?

Try it

First the simple courier: scp copies over SSH, every time. Build “copy menu.txt to my home folder on kedai”.

Tap the pieces in the right order.

…

Watch

laptop (lab)
rsync -av site/ kedai:shop/
sending incremental file list
created directory shop
./
index.html
menu.html
old.html
sent 313 bytes received 103 bytes 832.00 bytes/sec
total size is 62 speedup is 0.15
The first rsync -av site/ kedai:shop/ creates shop and sends index.html, menu.html and old.html.

rsync: A smart courier. It compares both sides and carries only what changed. is a smart courier. It compares both sides first, then carries only what differs. -a keeps times and permissions. -v lists each file.

Predict

You leave out the slash: rsync -av site kedai:copy/. Then you list both folders on kedai. What did the slash change?

copy/site/menu.html
copy/site/index.html
shop/menu.html
shop/index.html

Pick one answer.

Try it

You want kedai’s shop folder to match your site folder exactly, extras removed. --delete can remove files there. Put the safe steps in order.

First step at the top. Put these in order. Use the arrows, or drag.

  • rsync -av --delete --dry-run site/ kedai:shop/
  • rsync -av --delete site/ kedai:shop/
  • curl the page to check it
  • Read the list: is every deleting line expected?

Watch

laptop (lab)
rsync -av --delete --dry-run site/ kedai:shop/
sending incremental file list
deleting old.html
sent 104 bytes received 31 bytes 270.00 bytes/sec
total size is 58 speedup is 0.43 (DRY RUN)
rsync -av --delete --dry-run says deleting old.html and ends with (DRY RUN).

--dry-run says what would happen and changes nothing. Here: deleting old.html. Expected? Then run it for real.

Check

scp or rsync?

Drag a card into a box. Or tap the card, then tap the box.

      You did it!

      You can now send files to a server, and sync a folder safely.

      Go deeper (optional)

      Our practice server stands alone. These outputs came from two real Debian 13 machines. rsync must be on both machines: sudo apt install rsync. Copy back the other way with scp kedai:menu.txt . (the dot means here).

      Real mission

      1. scp notes.txt myvm:
      2. rsync -av --dry-run site/ myvm:site/
      3. rsync -av site/ myvm:site/

      0 of 3 steps done · Your ticks are saved.