Rsync (Remote Sync): 10 Practical Examples of Rsync Command in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Tarunika Shrivastava

I am a linux server admin and love to play with Linux and all other distributions of it. I am working as System Engineer with a Web Hosting Company.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

137 Responses

  1. DonaldShimoda says:

    I need to rsync two machines losing connectivity as an standard. I mean they only see on a short period of time and i can’t know when that happens. have rsync some exit code? Or must i just use an script and try one and another time until they see? Any timeout setup to allow the search to bee short?

    Best regards.

    • Ravi Saive says:


      If it’s a connection timeout because of SSH server is slow to respond, you can set the timeout option while running rsync as shown.

      # rsync -e 'ssh -o ConnectTimeout=120'
  2. Mashkoor Qadir says:

    Hello friends,

    Can any one tell me how to keep update my backup machine.

    The problem is here.

    Source to destination synchronization need to be 100% accurate. Actually I have 2 servers that I need to be sync (100% copy of each other). I have tested it in the following way.

    rsyncdemo dir on both servers that I need to synchronize that contains further sub folders and files.
    Test 1:

    # rsync -uvr -e ssh  /rsyncdemo [email protected]:/rsyncdemo 

    It copies all data successfully no issues. but problem is that if I delete a file or folder on the source machine it do not delete it from the destination.


    # rsync -uvr --delete -e ssh  /rsyncdemo [email protected]:/rsyncdemo 
    It checks on both servers if I deliberately delete a file from the source. The rsync command check it on destination and copy it back to source machine.
    I want to keep the destination machine up to date according to the source machine. 
    How to block/restrict the rsync no to copy any file or folder from the destination to source.
    Thanks in Advance
  3. sandeep says:


    I am trying to use the rsync with --delete (step :6). But unable to remove the files in the destination.

  4. Raj says:

    How do I use rsync to copy incremental files from window server to my linux server. Need to use sftp.

Got something to say? Join the discussion.

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