16.4. Introduction to Unison

16.4.1. Uses

Unison is an excellent solution for synchronizing and transferring entire directory trees. The synchronization is performed in both directions and can be controlled by means of an intuitive graphical front-end. A console version can also be used. The synchronization can be automated so interaction with the user is not required, but experience is necessary.

16.4.2. Requirements

Unison must be installed on the client as well as on the server. In this context, the term server refers to a second, remote host (unlike CVS, explained in Section 16.1.3. “CVS”).

In the following section, Unison is used together with ssh. An ssh client must be installed on the client and an ssh server must be installed on the server.

16.4.3. Using Unison

The approach used by Unison is the association of two directories (roots) with each other. This association is symbolic — it is not an online connection. In this example, the directory layout is as follows:


You want to synchronize these two directories. The user is known as tux on the client and as geeko on the server. The first thing to do is to test if the client-server communication works:

unison -testserver /home/tux/dir1 ssh://geeko@server//homes/geeko/dir2

The most frequently encountered problems are:

  • The Unison versions used on the client and server are not compatible.

  • The server does not allow SSH connections.

  • Neither of the two specified paths exists.

If everything works, omit the option -testserver.

During the first synchronization, Unison does not yet know the relationship between the two directories and submits suggestions for the transfer direction of the individual files and directories. The arrows in the Action column indicate the transfer direction. A question mark means that Unison is not able to make a suggestion regarding the transfer direction, as both versions were changed or are new.

The arrow keys can be used to set the transfer direction for the individual entries. If the transfer directions are correct for all displayed entries, simply click “Go”.

The characteristics of Unison (e.g., whether to perform the synchronization automatically in clear cases) can be controlled by means of command-line parameters specified when the program is started. The complete list of all parameters can be viewed with unison --help.

For each pair, a synchronization log is maintained in the user directory ~/.unison. Configuration sets such as ~/.unison/example.prefs can also be stored in this directory:

To start the synchronization, specify this file as the command-line parameter as in unison example.prefs.

16.4.4. More Information

The official documentation of Unison is extremely useful. For this reason, this section merely provides a brief introduction. The complete manual is available at http://www.cis.upenn.edu/~bcpierce/unison/ and in the SUSE unison.