rsync

August 23, 2021



These are just some examples of using rsync, so I don't forget about them. * Don't miss man rsync.

Example:

rsync -avHPKSi \
    --exclude='.git*' \
    --exclude='*.pyc' \
    --exclude='*.md' \
    --exclude='venv*' \
    --exclude='Dockerfile' \
    --delete-excluded \
    --delete \
    --info=progress2 \
    --stats \
    --checksum \
    --relative \
    --compress \
    ./* \
    user@host./home/ubuntu/release/123
rsync -a
    -a, --archive [archive mode]

Archive mode:

-a, --archive
  equals -rlptgoD:
  -r, --recursive [recurse into directories]
  -l, --links [copy symlinksas symlinks ]
  -p, --perms [preserve permissions]
  -t, --times [preserve modification times]
  -g, --group [preserve group]
  -o, --owner [preserve owner (super-user only)]
  -D, --devices and --specials [preserve device files (super-user only) and preserve special files]

Exclude:

--exclude=PATTERN [excludefilesmatching PATTERN]

Compression:

-z, --compress [compress file data during the transfer]
    --compress-level=NUM [explicitly set compression level]

Bandwith:

--bwlimit=RATE [specify maximum transfer ratefor the data sent]
# Example:
--bwlimit=10000 [kilo bit per second]

Progress:

--info=prgoress2 [fine-grained control over information output]
--stats [give some file transfer stats]