cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Etc


Reference














.

os:linux:command:rsync.html



Linux Commands#network

How to use rsync command in Linux

Local

rsync -avz /tmp/test1/ /tmp/test2.bk
rsync -avz /tmp/test1/ /tmp/test2.bk/

rsync -avz --delete /home/user1/ /tmp/user1.bk/

Remote

rsync -e ssh -avz --delete /home/user1/ user2@192.168.0.2:/home/backup/server1/home/user1/
rsync -e "ssh -i /home/user1/.ssh/nopass" -avz --delete /home/user1/ user1@192.168.0.2:/home/user1/backup/server1/home/user1/

Tips

bwlimit

rsync -e ssh -avz –-bwlimit=1250 FILE  user@192.168.0.2:/DIR/
--bwlimit=12500   # 100Mbps = 12500KBps
--bwlimit=1250   # 10Mbps = 1250KBps
--bwlimit=125    # 1Mbps = 125KBps
--bwlimit=62   # 500kbps = 62.5KBps

resume

$ rsyc -avz -e ssh   --progress --partial --append SOURCE-FILE xx.xx.xx:/DESTINATION/

$ nohup rsyc -avz -e ssh   --progress --partial --append SOURCE-FILE xx.xx.xx:/DESTINATION/ &

rsync as root

/etc/sudoers
user01 ALL= NOPASSWD:/usr/bin/rsync

rsync -a -e "ssh" --rsync-path="sudo rsync" user01@192.168.0.11:/root/test/ /test/tmp

etc

  • The '-a' is equals '-rlptgoD'. But General user cannot use 'goD' option. So General user must use -rlpt.


Linux Commands#network




os/linux/command/rsync.html.txt · Last modified: 2017/05/14 by admin

Page Tools