Rsync

From Network Security Wiki

Introduction

Rsync instance need to be installed on both server & client for rsync to work.

One-Liners

  • Synchronize Two Directories in a Local Server
rsync -zvr /var/opt/installation/inventory/ /root/temp
  • Synchronize Only One File
rsync -v /var/lib/rpm/Pubkeys /root/temp/
  • Synchronize Files From Local to Remote
rsync -avz /root/temp/ [email protected]:/home/thegeekstuff/temp/
  • Synchronize Files From Remote to Local
rsync -avz [email protected]:/var/lib/rpm /root/temp
  • Remote shell for Synchronization
rsync -avz -e ssh [email protected]:/var/lib/rpm /root/temp
  • Do Not Overwrite the Modified Files at the Destination
rsync -avzu [email protected]:/var/lib/rpm /root/temp
  • Synchronize only the Directory Tree Structure (not the files)
rsync -v -d [email protected]:/var/lib/ .
  • View the rsync Progress during Transfer
rsync -avz --progress [email protected]:/var/lib/rpm/ /root/temp/
  • Resume Support
rsync -avz --partial --progress [email protected]:/var/lib/rpm/ /root/temp/
rsync -avzP [email protected]:/var/lib/rpm/ /root/temp/
  • Delete the Files Created at the Target
rsync -avz --delete [email protected]:/var/lib/rpm/ .
  • View the Changes Between Source and Destination
rsync -avzi [email protected]:/var/lib/rpm/ /root/temp/
  • Include and Exclude Pattern during File Transfer
rsync -avz --include 'P*' --exclude '*' [email protected]:/var/lib/rpm/ /root/temp/
  • Do Not Transfer Large Files
rsync -avz --max-size='100K' [email protected]:/var/lib/rpm/ /root/temp/
  • Transfer the Whole File
rsync -avzW  [email protected]:/var/lib/rpm/ /root/temp
  • Rsync between Ubuntu and Windows
sudo apt-get install smbfs
sudo mount -t smbfs //LASTXP21/Data /mnt/data -o username=administrator,password=,rw
pkexec rsync -r -t -v --progress --ignore-existing -u -s /data/.personal/shotwell/ /mnt/data/Shotwell


{{#widget:DISQUS |id=networkm |uniqid=Rsync |url=https://aman.awiki.org/wiki/Rsync }}