(Last Updated On: March 9, 2019)

Are you in search for a fast, secure and easy to use backup program for Linux, macOS, and Windows?. Performing backup is a critical process for all System Administrators. Data is the most important aspect of business and we can’t trust our computers to keep data safe and available at all times. This is why we need an online and offline backup so we are able to restore in an event of system crash or unplanned disasters. All backed up data needs to be secure against any sort of attacks.

What is Restic?

Restic is a fast, secure and efficient backup program for Linux, macOS, Windows and BSD systems such as FreeBSD and OpenBSD. It uses cryptography to guarantee confidentiality and integrity of your data. Restic is written in Go and binaries are available for download on the release page. It is easy to configure and use.

Step 1: Install Restic Backup program

Install Restic on Debian/Ubuntu:

sudo apt-get -y install restic

Install Restic on Fedora:

sudo dnf -y install restic

Install Restic on FreeBSD:

sudo pkg install restic

Install Restic on RHEL & CentOS

sudo yum -y install yum-plugin-copr
sudo yum copr enable copart/restic
sudo yum -y install restic

Install Restic on Arch Linux

$ sudo pacman -S restic 

Install Restic on Windows

restic can be installed using Scoop:, check How to install Applications from Windows command linefor installation of Scoop and usage examples.

scoop install restic

You can check installed version of Restic using:

$ restic version
restic 0.9.4 compiled with go1.11.4 on linux/amd64

Update can be done with the restic self-update command.

$ restic self-update
writing restic to /usr/bin/restic
find latest release of restic at GitHub
restic is up to date

Configure Restic autocompletion.

$ sudo restic generate --bash-completion /etc/bash_completion.d/restic
writing bash completion file to /etc/bash_completion.d/restic
$ source /etc/bash_completion.d/restic

For Zsh – Install Zsh on Linux and Configure

$ mkdir ~/.zsh
$ restic generate --zsh-completion ~/.zsh/restic.zsh
writing zsh completion file to /home/jmutai/.zsh/restic.zsh
$ echo "source ~/.zsh/restic.zsh" | tee -a ~/.zshrc
$ source ~/.zshrc

Step 2: Create Restic Backup repository

Backups are saved in a repository. Restic has native support for the following backends.

In this guide, we will use AWS S3 service to store our backups. But you can also configure other backends by following the guides on above links.

Configure AWS S3 backend

Install and configure AWS CLI using our guide on how to install and use AWS CLI. Once this is done, create s3 bucket for saving files.

$ aws s3 mb s3://databackups.local
make_bucket: databackups.local

Replace databackups.local with the name of the bucket to create. S3 bucket can also be created from the AWS console.

Export AWS credentials if you don’t have them in ~/.aws/credentials.


Initialize a repository that uses your Amazon S3 as a backend.

$ restic --repo s3:s3.amazonaws.com/databackups.local init
enter password for new repository: <SetPassword>
enter password again: <ConfirmPassword>
created restic repository c564d0cd66 at s3:s3.amazonaws.com/databackups.local
Please note that knowledge of your password is required to access
the repository. Losing your password means that your data is
irrecoverably lost.

Step 3: Backing up Data with Restic

Now that we have the repository initialized, let’s start to backup our data. The contents of a directory at a specific point in time is called a “snapshot” in restic.

$ restic --repo s3:s3.amazonaws.com/databackups.local backup sitemap.xml
open repository
enter password for repository:
repository c564d0cd opened successfully, password is correct
created new cache in /home/jmutai/.cache/restic

Files: 1 new, 0 changed, 0 unmodified
Dirs: 0 new, 0 changed, 0 unmodified
Added to the repo: 13.719 KiB

processed 1 files, 13.340 KiB in 0:02
snapshot ca04a741 saved

This will upload sitemap.xml file to Restic repository s3:s3.amazonaws.com/databackups.local we created earlier. You will receive snapshot ID after the upload, in our case this is ca04a741.

To upload a directory with multiple files, just replace sitemap.xml with the name of directory.

List files in a repository

Use restic listto list objects in the repository.

$ restic --repo s3:s3.amazonaws.com/databackups.local list index
enter password for repository:
repository c564d0cd opened successfully, password is correct

$ restic --repo s3:s3.amazonaws.com/databackups.local list snapshots
enter password for repository:
repository c564d0cd opened successfully, password is correct

List files in snapshot using ls option. Pass the first 8 characters of Snapshot ID

$ restic -r s3:s3.amazonaws.com/databackups.local ls ca04a741
enter password for repository:
repository c564d0cd opened successfully, password is correct
snapshot ca04a741 of [/home/jmutai/sitemap.xml] filtered by [] at 2019-03-07 09:20:14.108746307 +0300 EAT):

You can also backup files from a list, and exclude files from a list.

$ find /path | grep 'PATTERN1' > /tmp/files_to_backup
$ find /path | grep 'PATTERN2' > /tmp/excludes.txt
$ restic -r /srv/restic-repo backup ~/work --exclude="*.c" --exclude-file=excludes.txt
$ restic -r /restic-repo backup --files-from /tmp/files_to_backup \
--exclude-file=/tmp/excludes.txt /otherfiles

For more usage examples, read Restic Documentation. Other guides available are:

How to Backup and Restore Ubuntu, Debian & Linux Mint using Timeshift

How to Backup files to Scaleway Object Storage using AWS-CLI

How to Install Nakivo VMware Backup & Replication tool on Linux

Ten Best Terminal Emulators for Linux