Keeps files synchronized between two computers. Tell unison the two directories and then in synchronizes it, to have on both directories the same contents. It shows what it likes to do, and waits for the manual OK.

Figure 7.2. Unison


I heavily use unison since years, Unison simply works as desired so there is not much to say. The only negative points are that is is a bit slow and the older versions struggle with microsoft filesystems used under linux. This has improved, if it fails unison tells why and how to fix it.

For the homepage https://www.cis.upenn.edu/~bcpierce/unison/index.html

It can synchronize between hard disk and usb memory stick but also between two different computer using ssh (don't use root for the ssh user).

Unison stores its configuration files containing the two root directories in the home directory of the user within the hidden directory ~/.unison. The files have the extension .prf (profile) and can be opened with an editor. It is also possible to edit them however unison will then restart from scratch.

Example to synchronize to directories on two different computers using ssh:

~/.unison/<name of the synchronisation>.prf

    root = /home/<username>/<directory>
root = ssh://<username>@<computername>//home/<username>/<directory>


When two computers are involved, then both need unison to be installed. Obviously this works best when both use the same version of unison.


Unison is over-writing read-only files. So it synchronizes also read-only files, this might be a nice feature but could also be considered problematic.

To ignore hidden files and directories

ignore = Name .* 
ignore = Path .*

To use the graphical user interface that is build using gtk set the gtk use flag.

Gentoo allows to switch between different unison versions in a controlled manner using the following commands:

eselect unison list

eselect unison set 1

If unison is installed the first time, it might be necessary to use the eselect unison set 1command.

Unison on the command line

Finally unison can be started from the command line, and seems to be faster this way!

The syntax is easy since the profile files in the ~/.unison directory can be passed without the prf extension:

unison<my unison profile>

Without profile file it takes the two directories as arguments:

unison<first directory><second directory>

The user interface on the command line is rather simple type in ? To get help.


  1. y yes

  2. > left to right

  3. / skip

If lots of directory structures have to be changed, it is a good advise to first synchronize both directories, modify one, then delete the other one, copy over the new directory structure, and run unison.

Unison with Microsoft file systems

Microsoft files systems do not support all the Linux permission options instead, default permissions are shown. This can cause problems with unison, since unison synchronizes also the permission bits and can therefore run into errors when it likes to modify NTFS and FAT permission bits. On the non-Microsoft files system run something as chmod -R 755 * to set the permissions to the default permissions of the NTFS or FAT file system, then synchronize the Linux and the NTFS or FAT file systems.

The permissions should be clean, this can become tricky when Windows file systems are used that don't support different users. Unfortunately there is also a mess with upper and lower case characters in filenames when using FAT. Sometimes the filenames change upper and lower case letters and results in Unison with a file name changed during synchronization error (This might be the FAT driver or Unison itself). Not using FAT and switching to NTFS-3g is probably the better option, the additional time to install it will quickly pay back.

Useful options to be put into the *.prf files are

ignorecase = true 

when dealing with FAT file systems that do not understand upper and lower case.


or set


Make that group and owner ships are not synchronized, this might be helpful when synchronizing Linux file systems with Microsoft file systems that does not support those features.

There is the perms parameter thats allows to set what permission bits should be considered


Don't worry if it is unknown to you what you have to set behind 0o newer unison will fail too but tell you what to set (or set it to 0 to not have the permissions synchronized at all). But do not forget to quit and restart unison.

There is also a Windows version, however the new versions require a complicated setup, the old unison versions require just one exe file that does not have to be installed.

Linurs Servernest startpage