UNIX 1.15 rsync command part 1

Support fuzicast.com by clicking on youtube ads and make sure to subscribe to my channel for more videos on UNIX, Perl and SQL.

facebook: facebook.com/fuzicast
twitter: @fuzicast
youtube: youtube.com/yuejdesigner85

SOURCE/DESTINATION can be local or remote
rsync sample.txt local/sample.txt
rsync sample.txt yjiang@testhost:~/sample.txt
rsync -e “ssh -i fuzicast-home.pem” sample.txt hadoop@testhost:~/sample.txt #use this for password-less access
rsync –progress # shows progress of data transfer
# you can time the following commands to check their execution time
rsync -zv sample.txt yjiang@testhost:~/sample.txt # -z for compressed transfer, -v for verbose
rsync -zvr local yjiang@testhost:~/ # -r for recurively copying
rsync -avz local yjiang@testhost:~/ # -a does many things, recursion and preserves timestamp, permission and links
# alternatively, you can use -l (preserve links), -p (preserve permission), -t (timestamp), -o (ownership), -g (group)
rsync -dv local yjiang@testhost:~/ # only synchronize directory tree
rsync -avz –delete local yjiang@testhost:~/ # in addition to synchronization, it will also delete any unmatched files in remote host
rsync -avz –existing local yjiang@testhost:~/ # synchronize but do not add new files to DESTINATION
rsync -avzi local yjiang@testhost:~/ # tells you which side has differences
f+++++++ local/badfile # f means differences in file, + means its new
f.st…. local/sample.txt # s means size differences, t means timestamp changed
rsync -avz –exclude ‘ex*’ local yjiang@testhost:~/ # exclude certain files
rsync -avz –max-size 200k local yjiang@testhost:~/ # set a max size for files to transfer
rsync -avzW local yjiang@testhost:~/ # force whole file transfer
rsync -avzn local yjiang@testhost:~/ # -n will do a dry run with no changes taken effect, it only tells you what would be changed
rsync -avzu local yjiang@testhost:~/ # update remote files only if local is newer than remote
give credit to http://www.thegeekstuff.com/2010/09/rsync-command-examples/

One thought on “UNIX 1.15 rsync command part 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s