unison
Synchronize files bidirectionally between two locations
TLDR
Sync two directories (creates log first time these two directories are synchronized)
Automatically accept the (non-conflicting) defaults
Ignore some files using a pattern
View documentation
SYNOPSIS
unison [options] dir1 dir2
PARAMETERS
-auto
Automatically resolve conflicts based on preferences (dangerous in certain situations).
-batch
Run in batch mode, without interactive prompts.
-backup
Enable file backups.
-backupdir
Specify the directory where backups are stored.
-ignore 'Path
Ignore paths matching the specified pattern.
-times
Compare files based on modification times.
-fat
Modifies how files are handled to synchronize with FAT filesystems.
-socket
Use specified TCP/IP port for the connection.
-ssh
Use the specified command instead of SSH.
-servercmd
Command to execute on the server side.
-ui text|graphic
Specify the user interface mode (text or graphic).
DESCRIPTION
Unison is a file synchronization tool for Unix-like systems and Windows. It allows you to keep two replicas of a collection of files and directories synchronized. Unison is particularly useful because it can handle changes made to both replicas and propagate them in a consistent and predictable manner, handling conflicting changes intelligently. Unlike simple mirroring or backup utilities, Unison can merge modifications from both locations. It works over a network, using SSH, rsh or direct socket connections.
Key features include:
Bidirectional synchronization, Conflict detection and resolution, Robustness, Efficiency, and Platform support.
CAVEATS
Unison can be complex to configure properly, especially with intricate ignore rules and conflict resolution strategies. Incorrect configuration can lead to data loss or unexpected synchronization behavior. Ensure thorough testing before relying on Unison for critical data.
PROFILES
Unison supports profiles, which allow you to save and reuse synchronization configurations. This simplifies managing multiple synchronization tasks with different settings. Profiles are usually stored in the `.unison` directory within the user's home directory.
CONFLICT RESOLUTION
When Unison detects conflicting changes, it presents the user with options for resolving them, such as choosing one version over the other, merging changes manually, or skipping the conflicting file. The `-auto` option can automate this process based on predefined rules, but should be used with caution. Unison tracks decisions about conflicts in its archive, so only novel conflicts must be addressed.
HISTORY
Unison was originally developed by Benjamin Pierce and colleagues at the University of Pennsylvania and has been under continuous development and refinement. It fills a niche between simple mirroring tools and more complex version control systems. The development was motivated by the need for a robust, bidirectional synchronization tool capable of handling various file system intricacies.