gsettings Command Examples in Linux

gsettings is a command-line tool for interacting with the dconf database, which is a key-value store used by the GNOME desktop environment to store configuration settings. The gsettings command allows you to query and modify the values stored in the dconf database, and it also provides schema validation to ensure that the values you set are of the correct type and conform to the constraints defined in the schema.

You can use gsettings to get the value of a particular key by running the command gsettings get [schema] [key]. For example, to get the value of the key background in the schema org.gnome.desktop.background, you would run gsettings get org.gnome.desktop.background background.

You can also use gsettings to set the value of a key by running the command gsettings set [schema] [key] [value]. For example, to set the value of the key background in the schema org.gnome.desktop.background to //cdn.thegeekdiary.com/path/to/image.jpg, you would run gsettings set org.gnome.desktop.background background /path/to/image.jpg.

gsettings also have other options like list-keys, list-schemas etc.

gsettings Command Examples

1. Set the value of a key. Fails if the key doesn’t exist or the value is out of range:

# gsettings set org.example.schema example-key value

2. Print the value of a key or the schema-provided default if the key has not been set in `dconf`:

# gsetings get org.example.schema example-key

3. Unset a key, so that its schema default value will be used:

# gsettings reset org.example.schema example-key

4. Display all (non-relocatable) schemas, keys, and values:

# gsettings list-recursively

5. Display all keys and values (default if not set) from one schema:

# gsettings list-recursively org.example.schema

6. Display schema-allowed values for a key (helpful with enum keys):

# gsettings range org.example.schema example-key

7. Display the human-readable description of a key:

# gsettings describe org.example.schema example-key
Related Post