Unison is a GUI and terminal-based tool which allows files and directories to be kept in sync with each other, between different local directories and drives or on a network, which could be on different operating systems. The application is available for Unix operating systems (Linux and Mac OS X) and Windows. Changes can be made on the different places, and Unison will update the machines with the correct versions of files and folders, copying, deleting, renaming or deleting files and directories as necessary. Unison doesn't currently work well with USB sticks that are formatted as VFAT (FAT32 FAT16 etc) due to file permissions. You might like to try usbsync for this instead.
Examples of uses
Heres a few scenarios on which Unison would be useful:
- Justine has a lot of music and would want to back it up to another drive in case her main drive fails. Unison can synchronize any new music she has added on her main hard drive, and will delete any music she has deleted from her main drive.
- Ryan has a laptop and a desktop computer. He works on both regularly and wants to be able to have his latest work available on the computer he wants to use. Unison will be able to syncronise both computers over the network using SSH so that work he has done on his desktop will appear on his laptop, and when he wants to use his desktop again, he can sync the files so they are updated there.
Unison can be found in Ubuntu's Universe software repository, in the unison package. Many users will also want the unison-gtk package as well for a GTK GUI. See InstallingSoftware for information about installing software, and Repositories if you need help enabling Universe. In order to use Unison with Ubuntu and Microsoft Windows, you will need to have Samba installed and setup. For instructions on setting up Samba in Ubuntu, see SettingUpSamba.
Unison includes a GUI interface that allows you to graphically work with the application. You can access it by going to Applications -> Accessories -> Unison or by pressing Alt+F2 and typing unison.
Different sync jobs in Unison are called 'Profiles'. For example, you may have a profile that synchronizes your music folder between two computers on a network, and another profile that synchronizes files between two drive. On starting Unison you will be presented with a window that allows you to select an existing profile or create a new one.
Choosing a profile
When you start Unison, you will be asked which profile you would like to use. To change the profile you are using while inside Unison, go to Synchronization -> Select a new profile from the profile dialog, or press P.
Making a new profile
On selecting Create New Profile you will be asked to enter a profile name. This name will represent the sync job when the Profile list appears when starting Unison. As the profile is new Unison will guide you though the steps of setting the root directories, which are the directories to be synced as part of the profile. The first root should be a local directory for example /home/[Username]/Music/. The second root can be local or on a target machine. Unison allows synchronization to be carried out over a network using SSH (further information at SSHHowto), RSH or a specific port on the target machine. Once this is complete Unison will scan the two locations and show the differences. You can then use the buttons Right to Left, Merge, Left to Right and Skip to tell Unison what it should do about each difference listed. Unison will guess which to do, but you will likely want to change it's guesses. Finally press Go to get Unison to perform all of your actions.
Unison can be used from the terminal. The following is a simple example to synchronize a music directory between two folders.
unison /home/[Username]/Music /location_of/other_directory
Or if a profile has been created.
unison "USB Stick"
Notice you do not need to specify a path, Unison searches in /home/[Username]/.unison/ for a corresponding profile. Depending on the size of the directories and the amount of files, a good amount of time may be needed. Unison can be setup to run on a schedule. This can be done by utilizing the "cron" scheduler. Further information regarding cron can be found at the CronHowto wiki page.
Included in Unison is a great help section, it can be found via the GUI under Help. Its topics include the different interfaces, the basic concepts and ways of running Unison. I would highly recommend reading this for more detailed information. To access Unison's help from the terminal, use: