Linux, terminal and Git

Stage 8 · Lesson 3 of 9

Copying files: scp and rsync

SSH, servers and debugging

Two tools copy files to and from a server over . is fine for a single file: scp file.txt myvps:~/. rsync is better for folders: rsync -avz ./site/ myvps:/var/www/site/. It only sends what changed and can resume after a break. --delete also removes files on the other side that you removed locally.

Watch the slash at the end of the source. With it, rsync copies what is inside the folder; without it, it copies the folder itself. Run with --dry-run first to see what would change. rsync also works as a simple backup tool.

Common traprunning rsync with --delete and the source and destination swapped, which deletes the files you meant to keep.

A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it

Resources for this stage

Start with· follow one of these

Practise

Keep handy

Also worth your time

  • The server, networking and troubleshooting branches of the Linux map

Mark this stage as not done?