Introduction
Deja Dup is a powerful and user-friendly backup tool that leverages the capabilities of Duplicity, its backend engine. While the graphical user interface (GUI) is intuitive, there are numerous commands available in the command line interface (CLI) that can enhance your backup management. This blog post will explore 12 useful Deja Dup commands that every user should know. By mastering these commands, you can automate, customize, and troubleshoot your backups more effectively.
1. Installing Duplicity |
Before you can use Deja Dup commands, you need to ensure that Duplicity is installed on your system. Duplicity is the backend tool that Deja Dup uses for its operations.
sudo apt install duplicity -y # For Ubuntu/Debian Distrossudo dnf install deja-dup -y # For RHEL/CentOS/Linux Distros with EPEL enabled2. Performing a Basic Backup |
To create a backup of a directory, use the following command:
duplicity /source/directory file:///destination/directoryFor example, to back up your Documents folder to an external drive:
duplicity /home/user/Documents file:///mnt/external/backup3. Restoring a Backup |
Restoring data from a backup is straightforward with Duplicity. Use the following command to restore your files:
duplicity restore file:///destination/directory /restore/directoryFor instance, to restore the backup from an external drive:
duplicity restore file:///mnt/external/backup /home/user/Documents4. Verifying a Backup |
To ensure that your backup is complete and correct, you can verify it using:
duplicity verify file:///destination/directory /source/directoryThis command compares the backup to the source directory and lists any differences.
5. Listing Backup Contents |
To see the contents of a backup, use:
duplicity list-current-files file:///destination/directoryThis command provides a detailed list of all files and directories in the backup.
6. Incremental Backup |
Duplicity supports incremental backups, which only store changes made since the last backup. To create an incremental backup, use:
duplicity list-current-files file:///destination/directoryIncremental backups are faster and require less storage space compared to full backups.

Photo by admingeek from Infotechys
7. Full Backup |
While incremental backups are efficient, it’s also important to perform full backups periodically. To force a full backup, use:
duplicity full /source/directory file:///destination/directoryFull backups ensure you have a complete copy of your data at a specific point in time.
8. Removing Old Backups |
To manage disk space, you may need to remove old backups. Use the following command to delete backups older than a specified number of days:
duplicity remove-older-than 30D file:///destination/directoryThis example removes backups older than 30 days.
9. Cleaning Up Backups |
Duplicity can sometimes leave behind incomplete or orphaned backup sets. To clean these up, use:
duplicity cleanup file:///destination/directoryThis command helps maintain a tidy and efficient backup directory.
10. Backup with Encryption |
To encrypt your backups for added security, use the --encrypt-key option:
duplicity --encrypt-key YOUR_GPG_KEY /source/directory file:///destination/directoryReplace YOUR_GPG_KEY with your actual GPG key ID. Encryption protects your data from unauthorized access.
11. Backup with Decryption |
To restore an encrypted backup, you need to provide the decryption key:
duplicity --decrypt-key YOUR_GPG_KEY restore file:///destination/directory /restore/directoryEnsure you have the necessary decryption key to access your data.
12. Scheduling Backups with Cron |
Automate your backups by scheduling them with Cron. Open the Cron configuration file:
crontab -eAdd a line to schedule the backup. For a daily backup at 2 AM, add:
0 2 * * * duplicity /home/user/Documents file:///mnt/external/backupThis ensures your backups occur automatically without manual intervention.
Summary: Useful Deja Dup Commands
| Command | Description |
|---|---|
sudo apt install duplicity -y | Install Duplicity |
duplicity /source/dir file:///dest/dir | Perform a basic backup |
duplicity restore file:///dest/dir /restore/dir | Restore a backup |
duplicity verify file:///dest/dir /source/dir | Verify a backup |
duplicity list-current-files file:///dest/dir | List backup contents |
duplicity incremental /source/dir file:///dest/dir | Perform an incremental backup |
duplicity full /source/dir file:///dest/dir | Perform a full backup |
duplicity remove-older-than 30D file:///dest/dir | Remove old backups |
duplicity cleanup file:///dest/dir | Clean up backups |
duplicity --encrypt-key YOUR_GPG_KEY /source/dir file:///dest/dir | Backup with encryption |
duplicity --decrypt-key YOUR_GPG_KEY restore file:///dest/dir /restore/dir | Restore encrypted backup |
0 2 * * * duplicity /home/user/Documents file:///mnt/external/backup | Schedule backup with Cron |
No comments:
Post a Comment