Linux command
dconf-write 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Write
dconf write /[path/to/key] "[value]"
Example
dconf write /[path/to/key] "'[string]'"
Example
dconf write /[path/to/key] "[5]"
Example
dconf write /[path/to/key] "[true]"
Example
dconf write /[path/to/key] "['first', 'second']"
Example
dconf write /[path/to/key] "@as []"
说明
dconf write sets a value in the dconf database. Values must be specified in GVariant text format, which requires careful quoting to satisfy both shell parsing and GVariant syntax requirements. The challenge with dconf write is the layered quoting: the shell requires quotes around the entire value argument, while GVariant format requires its own quotes for strings. This leads to constructions like "'string value'" where outer double quotes are for the shell and inner single quotes are GVariant syntax. Integers, booleans, and other types don't need the inner quotes. Changes take effect immediately for applications monitoring the dconf database. Unlike gsettings, dconf write doesn't validate values against schemas, so it's possible to write values that applications won't accept. For schema-validated writes with better error checking, use gsettings instead. dconf write is most useful in scripts where the value format is known and controlled.
FAQ
What is the dconf-write command used for?
dconf write sets a value in the dconf database. Values must be specified in GVariant text format, which requires careful quoting to satisfy both shell parsing and GVariant syntax requirements. The challenge with dconf write is the layered quoting: the shell requires quotes around the entire value argument, while GVariant format requires its own quotes for strings. This leads to constructions like "'string value'" where outer double quotes are for the shell and inner single quotes are GVariant syntax. Integers, booleans, and other types don't need the inner quotes. Changes take effect immediately for applications monitoring the dconf database. Unlike gsettings, dconf write doesn't validate values against schemas, so it's possible to write values that applications won't accept. For schema-validated writes with better error checking, use gsettings instead. dconf write is most useful in scripts where the value format is known and controlled.
How do I run a basic dconf-write example?
Run `dconf write /[path/to/key] "[value]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more dconf-write examples?
This page includes 6 examples for dconf-write, plus related commands for nearby Linux tasks.