A while ago, I explained how to reset a Linux desktop settings, tweaks and customization to default state with a single command. Today, we are going to learn how to backup and restore Linux desktop system settings with Dconf tool.
This tip will be useful when you wanted to transfer same system settings after reinstalling your Linux desktop system, without having to manually do them one by one.
Table of Contents
Install Dconf On Linux
Dconf comes pre-installed in many Linux distributions. If it is not installed already, you can install it using the distribution's default package manager depending upon the distribution you use.
On Arch Linux, Endeavour OS, Manjaro Linux:
$ sudo pacman -S dconf
On Debian, Ubuntu, Pop OS, Linux Mint:
$ sudo apt install dconf*
On CentOS, Fedora, AlmaLinux, Rocky Linux:
$ sudo yum install dconf
Or,
$ sudo dnf install dconf
On openSUSE:
$ sudo zypper install dconf
Backup And Restore Linux Desktop System Settings With Dconf
Believe or not, this is one of the easiest way to backup and restore system settings with a just single command.
To backup your current Linux desktop settings using dconf, do run this command:
$ dconf dump / > ostechnix-desktop
The above command will save all customization and tweaks you made in your system, including the pinned applications in the Dock or Unity launcher, desktop panel applets, desktop indicators, your system fonts, GTK themes, Icon themes, monitor resolution, keyboard shortcuts, window button placement, menu and launcher behaviour etc., in a text file named ostechnix-desktop.
Please note that this command will only backup the system settings. It won’t save settings of other applications that doesn’t use dconf. Also, it won’t backup your personal data either.
You can view this file using any text editors or cat
command.
$ cat ostechnix-desktop
Here is my Ubuntu 18.04 desktop settings:
Now reset your desktop settings to the factory defaults with command:
$ dconf reset -f /
After running the above command, your Linux desktop will turn into the old state when you installed it in the first time. Don't panic! Your personal data and installed applications will still be intact.
To restore the System settings, simply do:
$ dconf load / < ostechnix-desktop
It's that simple!!
Have a look at the following visual demo:
Keep the backup file in a safe place to use it later after reinstalling your Linux desktop.
You can use the same backup to multiple systems that runs the same OS version with same set of applications. For example if you have another Ubuntu 18.04 GNOME desktop, you can use this same file (i.e. ostechnix-desktop) to load the same settings as in your current system.
It is also possible to backup and restore settings for specific desktop environments like GNOME, MATE, Cinnamon etc.
Backup And Restore GNOME-specific Settings Only
For example, to backup and restore settings related to GNOME shell, the command would be:
$ dconf dump /org/gnome/ > my_gnome_settings
Make sure you have mention the correct path of the DE if you multiple DEs on your system.
Reset to factory defaults:
$ dconf reset -f /org/gnome/
To restore Gnome-only settings:
$ dconf load /org/gnome/ < my_gnome_settings
You can even backup more specific settings like desktop or window manager.
$ dconf dump /org/gnome/desktop/wm/preferences/ > old_wm_settings
Backup And Restore MATE-specific Settings Only
Backup settings:
$ dconf dump /org/mate/ > mate_settings
Reset to factory defaults:
$ dconf reset -f /org/mate/
To restore settings:
$ dconf load /org/mate/ < mate_settings
Backup And Restore Settings Of Cinnamon Desktop Only
$ dconf dump /org/cinnamon/ > cinnamon_settings
Reset to factory defaults:
$ dconf reset -f /org/cinnamon/
To restore settings:
$ dconf load /org/cinnamon/ < cinnamon_settings
For more details, check man pages.
$ man dconf
10 comments
there was no reference to backing up KDE Desktop
As far as I know, KDE doesn’t use dconf. So this tutorial doesn’t help for KDE users. May be you can find the settings saved in .kde/share/config/kioslaverc. I don’t have a KDE system now, so I can’t confirm.
I LOST THE BACKED FILE (localhost.localdomain.desktop , fedora 31) so i wasn’t able to restore my desktop configuration
Yikes. Don’t lose your files. ;?)
For KDE configs, check this out:
https://github.com/shalva97/kde-configuration-files
You will need to use the -f option when restoring as well.
dconf load -f / < backup
Otherwise you get a non writeable key error. The -f will write what can be written and ignore the non writeable keys.
Thanks for the input. Much appreciated.
Fantastic, but I’m going to need that amazing wallpaper. 🙂
I don’t have it unfortunately. Search on google.
Thanks for all this—very helpful! Cheers!