Software & AppsOperating SystemLinux

Changing dconf Keys via Command Line: A Guide for Post-Install Scripts

Ubuntu 1

In the world of Linux, customization is key. One of the tools that allows for such customization is dconf. It is a low-level configuration system and settings management. Its main purpose is to provide a backend to the GSettings API in GNOME programs. However, using it can be a bit tricky, especially when trying to change keys via the command line for post-install scripts. In this article, we’ll guide you through the process in a detailed manner.

Quick Answer

Changing dconf keys via the command line for post-install scripts is possible by using the dconf command-line tool. Ensure that you have the dconf-cli package installed, and then use the dconf write command to change the value of a key. After making changes, update the dconf database using the dconf update command. Troubleshoot any issues by creating the dconf database directory if it is missing or try using the gsettings tool as an alternative.

Understanding dconf

Before we dive into how to change dconf keys, it’s essential to understand what dconf is. dconf is a simple key-based configuration system. It stores its data in binary blobs which are faster to read than traditional text-based configurations.

Installing dconf-cli

To change dconf keys without a GUI, you can use the dconf command-line tool. However, you need to ensure that you have the dconf-cli package installed. You can install it by running:

sudo apt-get install dconf-cli

This command will install the dconf-cli package. sudo is a command that allows you to run programs with the security privileges of another user (by default, as the superuser). apt-get is a command-line tool which helps in handling packages in Linux. install is a command to install a package, and dconf-cli is the package name.

Changing dconf Keys

To change a dconf key, you can use the following command:

dconf write /com/canonical/indicator/session/show-real-name-on-panel false

In this command, write is used to change the value of a key. /com/canonical/indicator/session/show-real-name-on-panel is the key, and false is the value we want to set.

Updating the dconf Database

After changing a key, you need to update the dconf database. This can be done using the following command:

dconf update

This command updates the dconf database, ensuring that your changes are saved and applied.


If you encounter an error like “fatal: Error opening directory ‘/etc/dconf/db’: No such file or directory”, it means that the dconf database directory is missing. You can create it by running:

sudo mkdir -p /etc/dconf/db

Here, mkdir is a command to create a directory, and -p is a parameter that tells mkdir to create parent directories as needed.

Using gsettings As An Alternative

If you still encounter issues with the changes not being reflected, you can try using the gsettings tool instead. The gsettings tool is similar to dconf but operates at a higher level. To change a key using gsettings, you can use the following command:

gsettings set com.canonical.indicator.session show-real-name-on-panel false

In this command, set is used to change the value of a key. is the key, and false is the value we want to set.


In this article, we have covered how to change dconf keys via the command line for post-install scripts. We’ve gone through the process of installing dconf-cli, changing keys, updating the database, and troubleshooting common issues. We’ve also discussed using gsettings as an alternative tool. With this knowledge, you should be able to customize your Linux environment to suit your needs.

How can I check if `dconf-cli` is already installed on my system?

You can check if dconf-cli is already installed on your system by running the command dconf --version in the terminal. If it is installed, you will see the version number. If it is not installed, you will receive an error message.

Can I change `dconf` keys for other applications besides GNOME programs?

Yes, dconf can be used to change keys for other applications as well. However, it is primarily designed to work with GNOME programs. For non-GNOME programs, it is recommended to use the respective configuration tools provided by those programs.

How can I revert a `dconf` key back to its default value?

To revert a dconf key back to its default value, you can use the reset command. For example, to reset the key we used earlier, you can run dconf reset /com/canonical/indicator/session/show-real-name-on-panel. This will set the key back to its default value.

Can I specify a different `dconf` database directory?

Yes, you can specify a different dconf database directory by setting the DCONF_PROFILE environment variable. For example, you can run DCONF_PROFILE=/path/to/custom/directory dconf update to update the database in a custom directory.

Is it possible to change multiple `dconf` keys at once?

Yes, it is possible to change multiple dconf keys at once by using a script or a batch file. You can write multiple dconf write commands in the script, each for a different key, and then run the script to apply the changes to all the keys simultaneously.

Leave a Comment

Your email address will not be published. Required fields are marked *