unison

From RaySoft

Unison is a file-synchronization tool for POSIX-compliant systems (e.g. *BSD, GNU/Linux, macOS) 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. [1]

Syntax

unison [PARAMETER ...]
unison PATH1 PATH2 [PARAMETER ...]
unison PROFILE

Parameters

-auto true | false
When set to true, this flag causes the user interface to skip asking for confirmations on non-conflicting changes. (More precisely, when the user interface is done setting the propagation direction for one entry and is about to move to the next, it will skip over all non-conflicting entries and go directly to the next conflict.)
-backup PATHSPEC
Including the preference -backup pathspec causes Unison to keep backup files for each path that matches pathspec. These backup files are kept in the directory specified by the 'backuplocation' preference.
-backupdir PATH
If this preference is set, Unison will use it as the name of the directory used to store backup files specified by the backup preference, when 'backuplocation' is set to central.
-backuploc local | central
This preference determines whether backups should be kept locally, near the original files, or in a central directory specified by the 'backupdir' preference. If set to local, backups will be kept in the same directory as the original files, and if set to central, 'backupdir' will be used instead.
-batch true | false
When this is set to true, the user interface will ask no questions at all. Non-conflicting changes will be propagated; conflicts will be skipped.
-confirmbigdel true | false
When this is set to true, Unison will request an extra confirmation if it appears that the entire replica has been deleted, before propagating the change. If the batch flag is also set, synchronization will be aborted. When the path preference is used, the same confirmation will be requested for top-level paths. (At the moment, this flag only affects the text user interface.) See also the mountpoint preference.
-links true | false
When set to true, this flag causes Unison to synchronize symbolic links. When the flag is set to false, symbolic links will result in an error during update detection. Ordinarily, when the flag is set to default, symbolic links are synchronized except when one of the hosts is running Windows. In rare circumstances it may be useful to set the flag manually.
-log true | false
When this flag is set, Unison will log all changes to the filesystems on a file.
-logfile FILE
By default, logging messages will be appended to the file 'unison.log' in your HOME directory. Set this preference if you prefer another file.
-prefer root | newer | older
Including the preference -prefer root causes Unison always to resolve conflicts in favor of root, rather than asking for guidance from the user. (The syntax of root is the same as for the root preference, plus the special values newer and older.)
-preferpartial PATHSPEC -> root | newer | older
Including the preference preferpartial = PATHSPEC -> root causes Unison always to resolve conflicts in favor of root, rather than asking for guidance from the user, for the files in PATHSPEC (see the Path Specification section for more information). (The syntax of root is the same as for the root preference, plus the special values newer and older.)
-repeat NUMBER
Setting this preference causes the text-mode interface to synchronize repeatedly, rather than doing it just once and stopping. If the argument is a number, Unison will pause for that many seconds before beginning again.

Hints

Sync only single files
root = /home/alex/dropbox
root = /home/alex/project

path = project/file1.txt
path = project/file5.txt
Sync only Perl and Python files
root = /home/alex/dropbox
root = /home/alex/project

path = project1
path = project5

ignore = Name {,.}*{.*}
ignorenot = Name {,.}*.{pl,pm,py}

References

  1. Project contributers. "Unison." Unison project. https://github.com/bcpierce00/unison (accessed 01.07.2023)