Skip to content
Related Articles

Related Articles

Improve Article

rdiff-backup Command in Linux with Examples

  • Last Updated : 03 Jun, 2020

rdiff-backup is a command in Linux that is used to backup files over server or local machine and even has a feature of incremental backup which means it only contains those files that have been modified or changed. Its source code is written in python and hence it needs a python interpreter to function. It comes packed with many features like incremental and mirror backup and even it allows you to backup files over a network through SSH

Installing rdiff-backup Command

To install it use the following commands as per your Linux distribution.

In case of Debian/Ubuntu

$sudo apt-get install librsync-dev rdiff-backup

In case of CentOS/RedHat

$rpm -ivh epel-release-7-9.noarch.rpm
$yum install librsync rdiff-backup

In case of Fedora OS

$yum install librsync rdiff-backup

Working with rdiff-backup Command

1. To backup a folder.

$rdiff-backup ./backup_folder ./backup_folder.backup


This will create a backup file of the folder.

2. To exclude a file from the backup folder.

$rdiff-backup --exclude-filelist backup_folder/hii ./backup_folder/ backup_file.backup


This will exclude the specified file from the backup file.

3. To exclude files of a type.

$rdiff-backup --exclude '**ii' backup_folder/ backup_file.backup/


Here it will exclude all files with the suffix “ii”.

4. To list the modifications or increments.

$rdiff-backup -l backup_file.backup


This will list all the changes done so far in the backup file.

5. To restore a file from its previous versions.

$rdiff-backup backup_file.backup/rdiff-backup-data/increments/hii.2020-05-17T13\:52\:57+05\:30.diff.gz restore/hii


This will restore the file when it was previously backed up

6.To include specific type of files and eclude everything else.

$rdiff-backup --include "**ii" --exclude '**' backup_folder/ backup_file.backup/


This will include only thse files that have the suffix “ii”.

My Personal Notes arrow_drop_up
Recommended Articles
Page :