rsync example

Example 1: rsync from remote to local

rsync -chavzP --stats user@remote.host:/path/to/copy /path/to/local/storage

Example 2: rsync examples

The rsync command stands for Remote Synchronization.

The Linux command rsync is used to do a backup operation and fast copy file into the local system or remote system in UNIX/Linux.

rsync command examples

# rsync options source destination

$ rsync – zvr /var/www/website/   /root/tmp
$ rsync –avz /root/temp/ linuxconcept@192.168.5.111:/home/linuxconcept/temp/
$ rsync –avz linuxconcept@192.168.5.111:/var/lib/mysql /root/temp

Example 3: rsync

# It is a Lunux/UNIX tool to copy files to and from remote, 
# and between local directories.
# This tool is more efficient and versatile than SCP. 

rsync [options (it has a lot)] [source] [destination]

# To push
rsync [options] /tmp/myfile.txt root@123.456.786.23:/home

# To pull
rsync [options] root@123.456.786.23:/home/myfile.txt /tmp/

Handy options:
--compress --recursive --verbose

Example 4: rsync examples

we use rsync to perform the backup process in Linux/UNIX.

$ rsync –zvr /home/linuxconcept/newweb/ /var/www/linuxconcept/
$ ls –l  /home/linuxconcept/newweb/index.html  /var/www/linuxconcept/index.html
$ rsync –zva /home/linuxconcept/newweb/ /var/www/linuxconcept/
$ rsync –v /etc/ssl/linuxconcept/pubkeys /home/linuxconcept/pubkeys
$ rsync -avz  /root/temp/   linuxconcept@192.168.2.10:/home/linuxconcept/temp/
$ rsync -avz  linuxconcept@192.168.2.10:/home/linuxconcept/satish   /root/temp
$ rsync -avz -e ssh  linuxconcept@192.168.2.10:/home/linuxconcept/satish  /root/temp
$ rsync -avzhe ssh –progress /home/linuxconcept  linuxconcept@192.168.2.10:/root/rpmpkgs
$ rsync  –avz   – -delete  linuxconcept@192.168.2.10:/home/linuxconcept/    .
$ rsync  –avzhe ssh  – -max-size=’400k’  /home/linuxconcept/satish/  linuxconcept@192.168.2.10:/home/linuxconcept/tmp

Example 5: how to rsync linux

rsync options source destination