Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rsync

rsync synchronizes files between machines (or directories) and only transfers the parts that changed. It runs over SSH by default, resumes interrupted transfers, and can throttle its own bandwidth. That combination is why you reach for it on flaky or slow links, where scp would start over from zero.

Availability

PlatformHow to get it
Windows (Cygwin)install the rsync package
Fedorasudo dnf install rsync
Ubuntu / Debiansudo apt install rsync

rsync must be installed on both ends of the transfer. On Cygwin, local Windows paths are written as /cygdrive/c/....

Examples

The flag bundle used below: -a archive (recurse, preserve permissions and times), -v verbose, -h human-readable sizes, -z compress in transit, -S handle sparse files, -P show progress and keep partial files so interrupted transfers resume.

  • rsync push from local to remote:
rsync -avhzSP --stats folder-of-interest/ username@192.168.122.15:/share/folder-of-interest/
  • rsync pull from remote to local, limited to about 3.6 MB/s so the transfer does not saturate the link, with permissions forced on arrival:
rsync -avhzSP --stats --bwlimit=3600 --perms --chmod=a+rwx username@subdomain.domain.com:/home/username/completed/tv.shows/ /share/tv.shows/
  • Dry run first, to see what would be transferred or deleted before doing it:
rsync -avhn --delete folder-of-interest/ username@192.168.122.15:/share/folder-of-interest/

Beware the trailing slash: folder/ means “the contents of folder”, while folder means “the folder itself”. Get it wrong and everything lands one directory deeper than you wanted.