On-the-fly backup (backup a running system)

sudo rsync -e "ssh -i ${HOME}/.ssh/id_rsa" \
  -av \
  --delete \
  --numeric-ids \
  --exclude=proc/* \
  --exclude=sys/* \
  --exclude=tmp/* \
  root@${HOST}:/ .

limit bandwith to 2 mbit/s

rsync --bwlimit=2000 --delete -avz /media/backup/$(date -I)/
# Specify SSH key and configuration
sudo rsync -av \
    -e "ssh -i /home/foo/.ssh/id_rsa -F /home/foo/.ssh/config" \
    --delete \
    --numeric-ids \
    -av \
    /from/dir/ root@

Set owner and permissions

rsync -og --chown=nobody:nogroup --chmod=644 file.txt

Rsync files betwen two remote hosts withoud direct connection
ssh -A -R localhost:50000:${HOST_TO}:22 ${HOST_FROM} "rsync -e 'ssh -o StrictHostKeyChecking=no -p 50000' --delete -a ${DIR_FROM} localhost:${DIR_TO}"

Delete files after successfully copy

sshpass -p "${SSH_PASS}"\
  rsync -av --remove-source-files -e ssh ${SSH_USER}@${SSH_HOST}:~/htdocs/*.gz /mnt/backup/
rsync --remove-source-files -av /source/dir/
rsync -aHAXx --numeric-ids --delete --stats --info=progress2 --out-format="[%%t]:%%o:%%f:Last Modified %%M" --verbose -e "ssh -o 

Set file permissions

rsync --chmod=400 _.file1.pem