edit this article

Using Unison to Synchronize Two Directories

A very common question often asked in the Forums and on IRC is how to synchronize directories and files on a host or between different hosts.
Unison is a robust user-level file-synchronization tool that works cross-platform available under the GNU Public License.

To get in touch with the usage of unison we'll create two directories, create some files and sync them with the help of unison.

# mkdir testdir1
# touch testdir1/foo testdir1/bar
# mkdir testdir1/null
# touch testdir1/null/foobar
# mkdir testdir2

Now we want to synchronize testdir1 and testdir2 so that these directorys will contain the same files after unison finishes.

// We will use the textclient in this example:
# unison -ui text testdir1 testdir2
testdir1       testdir2
file     ---->            bar  [f]
file     ---->            foo  [f]
dir      ---->            null  [f]

The output of unison tells us that it successfully copied 2 files (bar and foo) and 1 directory from testdir1 to testdir2.

For tutorials and more information about the usage of unison check the Unison - User Manual and Reference.

rate this article:
current rating: average rating: 1.5 (54 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)