Unison is a bidirectional file synchronization tool that runs on Unix-like operating systems (including Linux, Mac OS X, and Solaris) and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other. It also unrestricted in terms of which system can be the host.
For offline documentation install Arch User Repository.AUR from the
In order to use Unison, you need to create a profile.
To configure Unison with the GUI run:
Alternatively, manually create a profile in
~/.unison and add the following lines to the default configuration file,
Define the root directory to be synchronized.
Define the remote directory where the files should be sychronized to.
Optionally, provide arguments to SSH.
Define which directories and files should be synchronized:
# dirs path=Documents path=Photos path=Study # files path=.bashrc path=.vimrc
You can also define which files to ignore:
ignore=Name temp.* ignore=Name .*~ ignore=Name *.tmp
Once your profile is set up, you can start syncing:
$ unison <profilename>
or using the GUI tool:
and select the profile. Unison has a nice interface where you can view the progress and changes.
For Unison to function properly, the same version must be installed on all clients. If, for example, one computer has version 2.40 and the other has 2.32, they will not be able to sync with each other. This applies to all computers that share a directory to be synchronized across your machines.
Due to the staggered releases with varying Linux distros, you might be stuck with older versions of Unison, while Arch Linux has the latest upstream version in the Extra repository. There are unofficial PKGBUILDs for versions 2.32 and 2.27 on the AUR that allow users of multiple distros to continue using Unison with their existing systems.
Tips & Tricks
Save human time and keystrokes
If one runs unison within a VDT emulator capable of maintaining a suitable scrollback buffer, there is no purpose in having to confirm every non-conflicting change; set the
auto option to true to avoid these prompts.
Common config sync
When syncing configuration files which would vary (e.g., due to endemic applications, security-sensitive configuration) among systems (servers, workstations, laptops, smartphones, etc.) but nevertheless contain common constructs (e.g., key bindings, basic shell aliases), it would be apt to separate such content into separate config files (e.g.,
.bashrc_common), and sync only these.
noupdateoption when bidirectional syncing between two particular systems is deemed unnecessary; when necessary, verify each change when syncing. Automatic bidirectional syncs should be done with extreme caution.