Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two linux box that i would like to keep in sync. I see option -avz syncs the remote with local but new local files are not pushed. How do i do this?

share|improve this question
up vote 1 down vote accepted

rsync is a one-way sync and it seems you want a two-way sync (files in both locations can change). There are other tools to do that -- unison is one.

  • Unlike simple mirroring or backup utilities, Unison can deal with updates to both replicas of a distributed directory structure. Updates that do not conflict are propagated automatically. Conflicting updates are detected and displayed.
  • Unison works between any pair of machines connected to the internet, communicating over either a direct socket link or tunneling over an encrypted ssh connection. It is careful with network bandwidth, and runs well over slow links such as PPP connections. Transfers of small updates to large files are optimized using a compression protocol similar to rsync.
  • Unison is resilient to failure. It is careful to leave the replicas and its own private structures in a sensible state at all times, even in case of abnormal termination or communication failures.
  • Unison is free; full source code is available under the GNU Public License.
share|improve this answer

rsync (despite having the name "sync") is only really one-way. You can have it delete files in the destination directory that don't exist in the source directory, but you can't simultaneously push and pull files both ways (you'll just need to run rsync again with the source and destination dirs swapped; I would recommend also the -u option so that only newer files overwrite older ones).

See also:

share|improve this answer
Running it in both directions wouldn't work in general because after you sync computer 2 to computer 1, any changes that had been made on computer 2 would be lost (rsync would overwrite them). – David Z Jul 14 '10 at 21:21
@David, right you are. I was only thinking of the case in which files changed in one location or the other, but not both at the same time. – Brian Jul 16 '10 at 13:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .