In a world of slow connections, we cannot afford to be wasteful. If you change a single word in a blog post, you shouldn’t have to re-upload the entire site. Rsync is the master of efficiency.

The Power of the Delta

Rsync uses a “delta-transfer” algorithm. It compares the file on your local machine with the one on the VPS and only sends the pieces that are different.

The Command of Choice

Here is how a Textsmith pushes their local public/ folder to the web server:

rsync -avz -e "ssh -p 22" public/ user@example.com:/var/www/thetextsmith/

Breakdown of the Strike:

  • -a: Archive mode (preserves permissions and timestamps).
  • -v: Verbose (tells you what’s happening).
  • -z: Compresses data during the trip (vital for saving bandwidth).
  • --delete: (Optional) Removes files on the server that you deleted locally.
---
*Forged in the terminal. Refined under the anvil.*