Unison is an open-source file synchronisation tool that allows you to keep two directories perfectly synchronised. It can be useful in many situations, such as synchronising files between a desktop computer and a laptop, backing up files to a cloud storage server, or sharing files between different users on a network.
Synchronising a Local Folder
To use Unison, you must first install it on each computer or device you want to synchronise. Unison is available for most operating systems, including Windows, macOS, and Linux. You can download the latest version of Unison from the official website of the tool.
Once you have installed Unison on each device you wish to synchronise, you can use the command line to start the synchronisation. Here’s an example command to synchronise two directories stored on your desktop computer:
unison /home/user/documents /home/user/backup
This command will synchronise the /home/user/documents
directory with the /home/user/backup
directory. Any files that are present in one of these directories but not the other will be added or deleted to ensure that the two directories are in perfect synchronisation.
Synchronising a Remote Folder
Unison can also be used to synchronise files between two remote computers or devices. To do this, you need to configure both computers to connect to each other via SSH. Once SSH is set up, you can use a command similar to the one above but replace the local directory path with the IP address or hostname of the remote computer.
For example, to synchronise files between two remote computers, you can run the following command:EnregistrerCopier
unison /home/user/documents ssh://user@remote-server//home/user/documents
In this example, the /home/user/documents
directory on your local computer will be synchronised with the /home/user/documents
directory on the remote computer named remote-server
.
There are many options available that you can use to customise the way Unison synchronises files.