I would like to know the default value of a dconf/gsettings key.

My question is a followup of the question below: Where can I get a list of SCHEMA / PATH / KEY to use with gsettings?

What I'm trying to do, so create a script that reads all my personal preferences so I can back them up and restore them. I plan to iterate though all keys, like the script above, see what keys have been changed from their default value, and make a note of these, that can be restored later.

I see that the dconf-editor display the keys' default value, but I'd very much like to script this. Also, I don't see how parsing the schemas /usr/share/glib-2.0/schemas/ can be automated. Maybe someone can help?

gsettings get-default|list-defaults would be nice =)

(Geesh, it was much easier in the old days where you just kept your ~/.somethingrc in subversion ... =\

Based on the answer given below, I've updated the script to print schema, key, key's data type, default value, and actual value:


for schema in $(gsettings list-schemas | sort); do
    for key in $(gsettings list-keys $schema | sort); do
        type="$(gsettings range $schema $key | tr "\n" " ")"
        default="$(XDG_CONFIG_HOME=/tmp/ gsettings get $schema $key | tr "\n" " ")"
        value="$(gsettings get $schema $key | tr "\n" " ")"
        echo "$schema :: $key :: $type :: $default :: $value"

This workaround basically covers what I need. I'll continue working on the backup scrip from here.

  • If anyone else also got here looking for how to reset a key to its default value, then gsettings reset KEY is the way to go. Jan 29, 2020 at 9:17

2 Answers 2


There does not seem to be a nice way to get at the default values directly, but since the client checks XDG_CONFIG_HOME in the environment a decent workaround to get values from a fresh config might be:

XDG_CONFIG_HOME=/nonexistent gsettings get SCHEMA KEY
  • 1
    For anyone wondering, you can use the same approach with dconf as well e.g. XDG_CONFIG_HOME=/nonexistent dconf read /path/to/key
    – Benjamin R
    Jan 4, 2022 at 22:41

If you are interested in backing up and restore your settings (in this case you should change the title of your question).


You can backup your settings with

gsettings list-recursively > backup

This writes all keys to the file backup in you Home-Folder.


As far as I know there isn't any direct option to import the file back to dconf. Maybe you could write a routine that reads the backup file line by line and executes gsettings set <input line from backup> to restore your settings.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .