GConf Command Line Tool

GConf includes a command line tool, gconftool-2. You can use the gconftool-2 command to perform the following tasks:

  • Set the values of keys.
  • Display the values of keys.
  • Install schemas from schema definition files when you install an application.

For example, use the following command to display the values of all keys in the /desktop/gnome directory and subdirectories.

gconftool-2 --recursive-list /desktop/gnome

Below are listed some of the options that you can use with the gconftool-2 command. For detailed command line options, please see man:gconftool-2(1).

gconftool-2 Command Options
--all-dirs

Lists all subdirectories in a directory that you specify.

--all-entries

Displays the values of all keys in a directory that you specify.

--config-source=configuration-source

Use this option with the --direct option to specify a configuration source to use. If you do not specify a configuration source with this option, the command runs on all configuration sources in the path file.

--direct

Use this option with the --config-source option to access a configuration source directly. When you use this option, GConf bypasses the server. Ensure that the GConf daemon, gconfd-2, is not running before you use this option.

--dump

Generates a list that contains all preference keys in a GConf repository directory that you specify. The list contains XML descriptions of all the keys. The list is contained in a <gconfentryfile> element.

For example, you can redirect the output from this option to generate a file that lists all keys that are related to your panel configuration. You can use the --load option with this file.

--get

Displays the value of a preference key that you specify. Also displays the values of the elements in the schema object for a schema key that you specify.

--help

Displays a help message about the gconftool-2 command, and the options that you can use with the gconftool-2 command.

--load=filename

Use this option to sets the values of preference keys in the current directory in a configuration source to the values in the file that you specify. The file that you specify must contain XML descriptions of the keys, in a <gconfentryfile> element.

--long-desc=description

Use this option with the --set-schema option to specify a long description for a schema key.

--makefile-install-rule

Installs schema definition files to applications.

--owner=owner

Use this option with the --set-schema option to specify an owner for a schema key.

--recursive-list

Displays the values of all preference keys in all subdirectories in a directory that you specify.

--recursive-unset

Resets the values of all preference keys, in all subdirectories in a directory, from the user setting to the setting in the default configuration source.

--set

Sets the value of a preference key, and writes the value to the user configuration source. Use the --type option with the --set option to specify the data type of the value that you want to set. For example, the following command sets the value of the /apps/gnome-terminal/profiles/Default/background_color key in the user configuration source:

gconftool-2 \
  --set "/apps/gnome-terminal/profiles/Default/background_color" \
  --type string "#000000"

You can also use the --direct option and the --config-source option with the --set option to write a value to another configuration source.

--set-schema

Sets the value of an attribute in a schema key, and writes the value to the default configuration source.

Use the following options with the --set-schema option to specify the attribute that you want to update:

  • --type
  • --short-desc
  • --long-desc
  • --owner

For example, the following command sets the short description in the schema key for the /apps/gnome-terminal/profiles/Default/background_color key:

gconftool-2 \
  --set-schema  "/schemas/apps/gnome-terminal/profiles/Default/background_color" \
  --short-desc "Default  background color of terminal"
--short-desc=description

Use this option with the --set-schema option to specify a short description for a schema key.

--shutdown

Terminates the GConf daemon.

--type=data-type

Use this option to specify the data type when you set a value of a preference key. You can also use this option when you set the value of an attribute in a schema key. The following is a list of valid data types:

  • bool
  • float
  • int
  • list
  • pair
  • string
--unset

Resets the value of a preference key from the user setting to the setting in the default configuration source.

--usage

Displays a brief help message about the gconftool-2 command, and the options that you can use with the gconftool-2 command.