1. Home
  2. Linux

How To Sync Files On Linux With Unison

Those looking for a quick, simple way to sync files on Linux should check out Unison. It’s a useful file synchronization program that can send data over the internet and on the local network.

Note: before using Unison, it’s essential to set up an SSH server on all Linux PC’s looking to sync files. Check out our guide to learn how to get it working!

Install Unison

Unison has both a terminal and graphical component to it. In this tutorial, we’ll cover both, and walk through how each of them works. Before we go over how to use Unison, you’ll need to install it on your Linux PC. On your computer, launch a terminal window and follow the commands below to get it working.

Ubuntu

Ubuntu users can install both Unison and Unison-GTK directly from the official software repositories. In the terminal, use the Apt package manager and set get them going.

sudo apt install unison unison-gtk -y

Debian

Unison is in the Debian official software sources, and you can easily install it using Apt-get.

sudo apt install unison unison-gtk -y

Getting Unison on Debian is a bit iffy, as the versions of the program are out of date. If you require a newer version of Unison, follow our guide here and learn how to set up Debian Backports.

Arch Linux

Unison is in the Arch Linux official software repositories. However, the graphical version of the interface will not install by default. Instead, when you use Pacman to install it, pay attention and select the GTK2 option during the installation. Selecting this option will set up the graphical interface.

sudo pacman -S unison

Alternatively, the Unison package as is in the Arch Linux AUR. Point your favorite AUR helper at it to get it working, or download and compile the package manually.

Fedora

Both Unison and Unison GTK are in the official Fedora Linux software repositories. If you’re a Fedora fan, you can easily install both versions of the program by launching a terminal and entering the commands below.

sudo dnf install -y unison unison-gtk

OpenSUSE

Unison and the Unison GTK component are in one package for OpenSUSE users. To install it, launch a terminal window and use the Zypper package manager to get it working.

sudo zypper install unison

Generic Linux

Unison works on all Linux users thanks to a generic binary package. Users can download and install both Unison GTK or Unison for terminal separately. To get these programs, follow the instructions below.

Unison GTK Instructions

Move the terminal into the Downloads folder. Then, use the wget downloading tool to get the latest package.

cd ~/Downloads
wget http://unison-binaries.inria.fr/files/unison-2.32.52_x86_64.zip

Or, if you need the 32-bit version of Unison, do:

wget http://unison-binaries.inria.fr/files/unison-2.32.12.linux.32bit.zip

Now that Unison is done downloading, the installation process can begin. Using the unzip program, extract the files from the Zip folder, and update the file’s permissions.

sudo chmod +x unison-2.32.52_x86_64

Run the program with:

./unison-2.32.52_x86_64
Unison Terminal Instructions

Installing Unison text mode is very similar to the GTK version. To do it, move your terminal into the Downloads folder, then wget the package.

cd ~/Downloads

wget http://unison-binaries.inria.fr/files/2011.01.28-Esup-unison-2.40.61-linux-x86_64-text-static.tar.gz

Or:

wget http://unison-binaries.inria.fr/files/2011.01.28-Esup-unison-2.40.61-linux-i386-text-static.tar.gz
tar xzvf 2011.01.28-Esup-unison-2.40.61-linux-*-text-static.tar.gz

Update the permissions of Unison with the chmod command.

sudo chmod +x unison-2.40.61-linux-*-text-static

Run with:

./unison-2.40.61-linux-*-text-static

Sync Folders With Unison Terminal

Unison works very well in the terminal thanks to its very straightforward command-line interface. When attempting to sync files via the command-line in Unison, it’s best to go with SSH, as most Linux PCs will have it set up.

To synchronize the contents of a directory with Unison on the command-line, open up a terminal and enter the command-line below. Be sure to customize the Unison command below to suit your needs.

unison /location/of/folder/to/sync ssh://ip.address.of.remote.computer//location/of/folder/to/sync/

Sync Folders With Unison GTK

To sync with Unison GTK, you must create a profile first. Launch the app and click the option to create a new profile. Alternatively, look for the “+Add” button in the Profile Selection window.

In the profile selection window, fill out your name and select the type of transfer you’d like. In this tutorial, we’ll be setting up an SSH transfer connection, as it’s the most reliable remote transfer setup for Linux users.

Selecting “SSH” in the dropdown menu will reveal SSH connection settings. Fill out the connection settings with the remote Linux PC or server you’d like to sync files with and click “Forward” to continue to the next page.

On the final page of the setup process for Unison GTK, you’ll need to set up both the remote and local directories. After setting your folders up, click “Forward,” then the “Apply” button to start the syncing process in the Unison app.

Leave a comment