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. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux course in 5 Days

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.

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Introduction to Linux - A Hands on Guide

You may also like...

96 Responses

  1. Mark says:

    Thank you for the post.

    May I ask you if you may know how to setup a directory sync between two servers while using daemon running under /etc/xinetd.d/rsync.

    I target not to use just a command like in your examples, but to have xinetd running rsync in the background.. examples of rsyncd.conf are not clear how to setup the path and the destination servers.

    Also in /etc/xinetd.d/rsync configuration there is no reference thus it is not clear if rsyncd.conf can be relevant and used at all. So how to make only two specific servers setup this way where one will be a source and another a destination, meaning that the content will be actively changing on one server, while another will get its folder just synced with the first one.

    • Ravi Saive says:


      Sorry, no idea never thought of running rsync under xinted, will certainly try and give solution if it works successfully

  2. IT says:

    Nice and relevant examples.

  3. Ravindra says:

    Hi, really its very helpful .. Thanx for this article

  4. LD says:

    Hi, I want to copy the files from one location to another over WAN. both locations are in two geographical locations. Is it possible to achieve it through RSYNC ??

    • Ravi Saive says:


      Of course yes, rsync will work with any network even both machines are on different network and far from each other, rsync works well.

      • LD says:

        how the source and destination paths are going to be mounted then ?

        • Ravi Saive says:


          Rsync is used to sync files between two servers or transfer files from local to remote and vice-versa, it’s not meant for mounting. Could you explain me more about your questions? so that I can help you more better way..

  5. Alex says:

    Thank you! Really well explained.

  6. ash says:

    Nice post.

  7. Azim Khan says:

    Thanks You very helpful commands for beginners like me but I am looking for copying files using rsync command from one server to another server directly which I did not get. If anybody have please share .

  8. Under RHEL 5.0, there is no argument called “–remove-source-files” instead there is a option called “–remove-sent-files”
    For example: If you are trying to copy the file to a local or remote system, you would use the following command.

    $ rsync –remove-sent-files -avzh /tmp/aziz.tar root@localhost:/tmp/backup1/

    Note: While specifying the destination directory, if the directory is not proceeding with ‘/’ it will create a file called /tmp/backup1. We need to ensure the directory ends with ‘/’ if we want to create the destination directory while runnning rsync.

    Hope it helps

  9. kirba says:

    Thanks for this tutorial. I am a beginner in the server world and i find this quite useful.

    I have some questions and if you can answer that would be great.

    I need to transfer data from one remote server to another.
    rsync -av root@ root@

    is this going to work?
    also is there any option to run rsync command and then log out from my console (leaving rsync in progress). I need to transfer around 150GB and it would be great if i dont have to leave my terminal on.

    Kind regards

    • Ravi Saive says:

      I never tried that way and I am not sure it will work or not, I think you should give a try and see how it works and to keep the session active better run via cron..

    • Matthys Potgieter says:

      Hi, tmux is a great tool for this (as well as screen), for detaching from a running process/terminal and reattaching later. also nohup command may be useful but not as versatile for this purpose, as it demonizes your process and writes to a log file

  10. sandeep says:

    I am new to linux. This site is Really useful..!! Thankx

Got something to say? Join the discussion.

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

Join Over 150K+ Linux Users
  1. 100,756
  2. 5,113
  3. 36,418

Enter your email to get latest Linux Howto's