Synchronize files with rsync

Original link: https://hsiaofeng.com/archives/225.html

rsync is a Linux software for file synchronization, which can realize file synchronization between local-local or local-remote. Using rsync, when updating a static website, it is not necessary to package the whole site, and only update the parts that need to be updated, saving server bandwidth and time.

Common methods:

 rsync -avuz 本地路径用户名@服务器地址:远程路径

Example:

 rsync -avuz /mnt/e/wwwroot/html/ [email protected]:/var/www/html/

in,

  • -a means archive mode, including recursion, saving all metadata, such as modification time, permissions, owner, etc., and soft links will also be synchronized.
  • -u means to skip files that are newer than local in the target directory.
  • -v means output verbose.
  • -z means to compress the data when synchronizing.

Reference: rsync usage tutorial – Ruan Yifeng’s weblog

This article is transferred from: https://hsiaofeng.com/archives/225.html
This site is only for collection, and the copyright belongs to the original author.