Quick Usage Guide[edit | edit source]
Copying Files via SSH[edit | edit source]
To copy files from
/export/backup to a remote location (on server 'backup'):
$ rsync -avz /export/backup/ -e ssh backup:/export/backup/ ## Or with a non-standard SSH port $ rsync -avz /export/backup/ -e "ssh -p 2222" backup:/export/backup/
Copying files with Progress Information[edit | edit source]
$ rsync -avh --progress /src/ /dst/
Limiting Bandwidth[edit | edit source]
The transfer rate can be limited with the
--bwlimit=kbps option. Bytes per second is the default if no unit is given.
## Limit transfer speed to 1MB/s $ rsync --bwlimit=1024 /source/ /destination/ $ rsync --bwlimit=1m /source/ /destination/
Parallel Copy[edit | edit source]
You may wish to run multiple rsync in parallel to speed up data transfers.
## Transfers /source/directory tot /destination/directory with 5 parallel jobs $ ls -1 /source/directory/ \
Copying Directories[edit | edit source]
Because I've been bitten by this issue way too many times in the past couple of days, to avoid copying a directory into another directory, always have a trailing slash from the source.
In more depth, suppose I have a
src directory and I want its contents to be replicated in
## This copies 'src' into 'dst/src' $ rsync -avh src dst ## This too copies 'src' into 'dst/src' $ rsync -avh src dst/ ## Works as expected. Contents in src is now in dst $ rsync -avh src/ dst ## Works as expected as well $ rsync -avh src/ dst/