Andrew Pennebaker
https://github.com/mcandre/cheatsheets/blob/master/rsync.md
Rsync is an efficient, fault-tolerant, file and folder synchronization system.
$ apt-get install rsync
$ brew install rsync
C:\> chocolatey install rsync
Rsync encourages authentication with SSH keys, skipping the need for password authentication. Consult your GitHub or GitLab documentation for more information on setting up SSH keys.
Like SSH, If SSH keys are not fully setup, rsync automatically downgrades to basic password authentication.
$ rsync -a <source> <destination>
Where:
-a
means "synchronize all aspects of a file, including contents, name, permissions, and timestamp. If-a
is omitted, then directories may not be copied over recursively.<source>
and<destination>
may be local file paths, SSH-compatible file paths, or a mix of both.
$ rsync -a books /mount/thumb-drive
cp -r books books-backup
may be faster, but Rsync can resume a long or corrupted transfer, e.g. if a USB drive disconnects. Also, Rsync can show an overall progress bar, whereas cp
with pv
would only show a per-file progress bar.
--info=progress2
Requires rsync 3.1.0+.
$ rsync -a books me@mybookserver.com:/home/me/
$ rsync -a me@mybookserver.com:/home/me/books .
$ rsync -a books me@mybookserver.com:/home/me/
Control+C
Rsync is fault-tolerant, able to easily resume an interrupted transfer. So feel free to pause (kill) an Rsync transfer if you ever want to.
If Rsync is interrupted, repeat the last command to continue the transfer.
$ rsync -a books me@mybookserver.com:/home/me/
<network disconnection occurs>
Control+C
<network connection restored>
$ rsync -a books me@mybookserver.com:/home/me/
$
--chmod=<octal>
--chown=<owner:group>
/etc/rsyncd.conf
Example:
https://raw.githubusercontent.com/seL4/isabelle/master/Admin/rsyncd.conf
$ sudo service rsync start
$ sudo /etc/init.d/rsync start
$ sudo rsync --daemon
$ sudo service rsync stop
$ sudo /etc/init.d/rsync stop
$ sudo killall rsync