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/ thegeekstuff@192.168.200.10:/home/thegeekstuff/temp/
  • Synchronize Files From Remote to Local
rsync -avz thegeekstuff@192.168.200.10:/var/lib/rpm /root/temp
  • Remote shell for Synchronization
rsync -avz -e ssh thegeekstuff@192.168.200.10:/var/lib/rpm /root/temp
  • Do Not Overwrite the Modified Files at the Destination
rsync -avzu thegeekstuff@192.168.200.10:/var/lib/rpm /root/temp
  • Synchronize only the Directory Tree Structure (not the files)
rsync -v -d thegeekstuff@192.168.200.10:/var/lib/ .
  • View the rsync Progress during Transfer
rsync -avz --progress thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
  • Resume Support
rsync -avz --partial --progress thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
rsync -avzP thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
  • Delete the Files Created at the Target
rsync -avz --delete thegeekstuff@192.168.200.10:/var/lib/rpm/ .
  • View the Changes Between Source and Destination
rsync -avzi thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
  • Include and Exclude Pattern during File Transfer
rsync -avz --include 'P*' --exclude '*' thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
  • Do Not Transfer Large Files
rsync -avz --max-size='100K' thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
  • Transfer the Whole File
rsync -avzW  thegeekstuff@192.168.200.10:/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 }}