rsync is a great tool for copying files, especially to/from remote locations, like ssh-servers. I use it almost daily for managing this website and also for backing up some personal files to a server so I have access to them from anywhere. For syncing different computers on the same wifi I recommend Syncthing.
I almost always use
rsync -avzhu --delete src dest
-aarchive mode: equivalent to
-rlptgoD, which basically means replicate everything as exactly as possible
-rrecurse into directories
-lrecreate symlinks in the destination
-ppreserve permissions in
-tpreserve modification times
--devices --specials, which preserves device and special files
-zcompress the files during the transfer
-houtput numbers in human-readable format
-uupdate: skip files that have a newer modification time at
--deletedelete extraneous files from
Sometimes I want to exclude a certain directory from being updated/deleted, so I use the
--exclude dir option as well.
I use a small wrapper script for deploying to the webserver and for my personal documents I’ve created two wrapper scripts, one for pulling and the other one for pushing.
If you want to give me some feedback or share your opinion, please contact me via email.
© Niklas Bühler, 2021 RSS / Contact me