Open In App

rdiff-backup Command in Linux with Examples

Last Updated : 05 Aug, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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  

$wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
$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 

to-backup-a-folder

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

backup-but-exclude-file

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/

to-delete-file-if-failed

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

4. To list the modifications or increments.  

$rdiff-backup -l backup_file.backup

list-backup-modifications2

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 
 

to-restore-a-file-rdiff-backup

This will restore the file when it was previously backed up 

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

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

include-specific-files

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


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads