rsync options source destination
-v : verbose
-r : copies data recursively (but don’t preserve timestamps and permission while transferring data
-a : archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships and timestamps
-z : compress file data
-h : human-readable, output numbers in a human-readable format
-e : specify a protocol

rsync -zvh backup.tar /tmp/backups/
rsync -avzh /root/rpmpkgs /tmp/backups/
rsync -avz rpmpkgs/ root@
rsync -avzh root@ /tmp/myrpms
rsync -avzhe ssh root@ /tmp/
rsync -avzhe ssh backup.tar root@
Add a port :
rsync -avzhe "ssh -p1234" backup.tar root@

These two options allows us to include and exclude files by specifying parameters with these option helps us to specify those files or directories which you want to include in your sync and exclude files and folders with you don’t want to be transferred.

rsync -avzhe ssh --progress /home/rpmpkgs root@
rsync -avze ssh --include 'R*' --exclude '*' root@ /root/rpm

We can use ‘–delete‘ option to delete files that are not there in source directory.

rsync -avz --delete root@ .

rsync --dry-run --remove-source-files -zvh backup.tar /tmp/backups/

Set Bandwidth Limit and Transfer File

rsync --bwlimit=100 -avzhe ssh /var/lib/rpm/ root@

Also, by default rsync syncs changed blocks and bytes only, if you want explicitly want to sync whole file then you use ‘-W‘ option with it.

rsync -zvhW backup.tar /tmp/backups/backup.tar



2019-05-04 22:00:04


Add a Comment

Login or Register to post a Comment.