I want to reset all keys in the GSettings to their default values; preferably using a single command, or a simple bash script. How can I get that done?
5 Answers
Generally you can reset one key to its default value with
gsettings reset SCHEMA [:PATH] KEY
So you might use a bash script to do for all available keys.
Something like (pseudocode):
for i in /dir/of/keys
do
gsettings reset <key-path>
done
Look at its man-page for more information: man gsettings

- 13,065
- 5
- 49
- 65

- 102,391
- 106
- 255
- 328
-
1a little more help with the dir-of-keys please... and can I use wild cards there for key path?... – rusty Dec 21 '13 at 09:40
-
I mean where you have the keys. If you know the key then you can do it. – Raja G Dec 21 '13 at 13:31
The following will reset all those settings which are "non-relocatable". That is, the ones that are stored at a standard location and hence do not need an extra path specified after them. For example it will reset all keys of org.gnome.eog.fullscreen
, but none of org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/
.
It only does so for the user executing it.
gsettings list-schemas | xargs -n 1 gsettings reset-recursively

- 61
I had the same problem with some media keys,they just worked sometimes so i needed to reboot or reset them manually with dconf-editor or gsettings.
maybe you could do a bash script like this
#!/bin/bash
#To get in a list all the keys of that directory
list=$(gsettings list-keys <keys-path-directory>);
for i in $list; do
echo "resetting $i";
gsettings reset <keys-path-directory> $i;
done

- 11
- 2
On Linux systems, GSettings uses dconf for its backend. For any settings that do not appear in the user’s db, dconf returns an empty value (or searches down the hierarchy if a profile is defined), and GSettings falls back to the default value. Therefore, in order to reset all GSettings keys to their default or system fallback values on Linux, simply wipe out the dconf database for the user:
dconf reset -f /

- 121
This is a helpful script:
#!/bin/bash
schema="org.gnome.desktop.wm.keybindings" # Change this to your target schema
keys=$(gsettings list-keys $schema) # Get the list of keys for the specified schema
for key in $keys; do # Iterate through the keys and reset each one
gsettings reset $schema $key
done

- 2,426