Skip to main content

rsync

# <source>, <destination> = [[<user>@]<host>:]<path>
# rsync <option> <source> <destination>

rsync -avHAX --info=progress2 ssh://user@host:/path/to/source /path/to/destination

Option

OptionDescription
-a, --archiveArchive mode, equals -rlptgoD (no -H, -A, -X)
-H, --hard-linksPreserve hard links
-A, --aclsPreserve ACLs (implies -p)
-X, --xattrsPreserve extended attributes
-v, --verboseVerbose
-z, --compressCompress during the transfer
--partialKeep partially transferred files
--progressShow progress
--info=progress2Show total progress / speed
--bwlimit=<rate>Limit bandwidth, --bwlimit=1m = 1 MiB/s
-P--partial --progress
-e "ssh [-p <port>]"Use SSH as remote shell
-s, --protect-argsNo space-splitting (If file name has space)

Trailing slash on <source>

  • /src/ means files under /src/*
# sync /src/ to /dest/src/
rsync -av /src /dest
# same as
rsync -av /src/ /dest/src