rsync cheatsheet

rsync -az -e ssh --delete $syncfrom $syncto

http://www.cyberciti.biz/tips/linux-use-rsync-transfer-mirror-files-directories.html

Copy file from a local computer to a remote server

$ rsync -v -e ssh /www/backup.tar.gz jerry@openbsd.nixcraft.in:~

Copy file from a remote server to a local computer

$ rsync -v -e ssh jerry@openbsd.nixcraft.in:~/webroot.txt /tmp

Synchronize a local directory with a remote directory

$ rsync -r -a -v -e "ssh -l jerry" --delete openbsd.nixcraft.in:/webroot/ /localwebroot

Synchronize a remote directory with a local directory

$ rsync -r -a -v -e "ssh -l jerry" --delete /local/webroot openbsd.nixcraft.in:/webroot

Synchronize a local directory with a remote rsync server

$ rsync -r -a -v --delete rsync://rsync.nixcraft.in/cvs /home/cvs

Mirror a directory between my “old” and “new” web server/ftp
You can mirror a directory between my.old.server.com and “new” web server with the command (assuming that ssh keys are set for password less authentication)

$ rsync -zavrR --delete --links --rsh="ssh -l vivek" my.old.server.com:/home/lighttpd /home/lighttpd

Leave a Reply

Your email address will not be published. Required fields are marked *