unison

Bidirectional file synchronization tool

TLDR

Sync directories
$ unison [dir1] [dir2]
Sync with SSH
$ unison [local/path] ssh://[user@host]/[path]
Batch mode
$ unison -batch [dir1] [dir2]
Use profile
$ unison [profilename]
Show differences
$ unison -diff [dir1] [dir2]

SYNOPSIS

unison [-batch] [profile] root1 root2

DESCRIPTION

unison is a file synchronization tool that propagates changes in both directions between two directory replicas. Unlike one-way sync tools like rsync, unison detects modifications on both sides and reconciles them, making it suitable for keeping directories in sync across multiple machines.When conflicts arise from both replicas being modified, unison detects the conflict and presents options for resolution rather than silently overwriting changes. It can synchronize over SSH for remote directories or work with local paths. The tool tracks file state between synchronizations, so it only transfers files that have actually changed.Unison supports profiles that save synchronization configurations for repeated use, including path filters, ignore patterns, and connection settings. It runs on Unix, macOS, and Windows, and requires the same version of unison on both sides of a synchronization.

PARAMETERS

-batch

Non-interactive.
-auto
Accept defaults.
-diff
Show differences.
-force ROOT
Force from root.
-ignore PATTERN
Ignore pattern.
-path PATH
Sync specific path.

INSTALL

sudo dnf install unison
sudo pacman -S unison
sudo apk add unison
sudo zypper install unison
brew install unison
nix profile install nixpkgs#unison

CAVEATS

Both sides must run the same version of unison; version mismatches cause failures. Conflicts require manual attention. Initial synchronization can be slow for large directory trees.

HISTORY

Unison was developed by Benjamin Pierce at the University of Pennsylvania, first released around 2001. It is written in OCaml and based on research in file synchronization theory.

SEE ALSO

rsync(1), syncthing(1), rclone(1)