I have two Ubuntu machines, a laptop and a desktop. What I wish to do is, to create a folder in both machines at paths 'path1' and 'path2'. I want to set up sync between the two folders whenever they are connected to the same local area network (Desktop through Ethernet and Laptop through WLAN). So for example, if I create a file path1/x, it will also appear in path2 as path2/x.

Is there a way I can get this done? [It's ok if deletion sync doesn't work and I have to manually delete a file from both directories simultaneously]


2 Answers 2


[Answering my own question as I found a nice way to do this]

Use unison tool developed by Benjamin Pierce at U Penn.

Let us assume you have two directories,

/home/user/Documents/dirA/ and /home/user/Documents/dirB/

To synchronize these two, you may use:

~$unison -ui text /home/user/Documents/dirA/ /home/user/Documents/dirB/

In output, unison will display each and every directory and file that is different in the two directories you have asked to sync. It will recommend to additively synchronize (replicate missing file in both locations) on the initial run, then create and maintain a synchronization tree on your machine, and on subsequent runs it will implement true synchronization (i.e., if you delete a file from .../dirA, it will get deleted from .../dirB as well. You can also compare each and every change and optionally choose to forward or reverse synchronize between the two directories.

Optionally, to launch graphical interface, simply remove the -ui text option from your command, although I find the cli simpler and faster to use.

More on this: Unison tutorial at Unison user documentation.


Check out this tutorial on how to sync folders using rsync.


  • 2
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – RolandiXor
    Jan 1, 2017 at 22:39
  • 2
    For the community to be more effective, it is necessary to provide more detail in the answers, a link is not enough, in which case it is not an answer but rather a comment.
    – Alejandro
    Mar 20, 2018 at 21:05

You must log in to answer this question.

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