From a developer's perspective. Should I use a text-based config in /etc or in $HOME? Or something else?
Asked
Active
Viewed 4,153 times
13
-
I lack the expertise to know whether they would be preferred or not, but GConf and dconf are other ways to store application settings. – Firefeather May 13 '11 at 21:17
-
1Thanks for the suggestion. Personally, I prefer plain files because I have nightmares about the registry of windows. In my opinion the ideal way of storing settings is plain text files, preferably with a standard format (INI, JSON, XML, YAML etc.). A single database (especially dconf which is monolithic) is a single point of failure. – Tamás Szelei May 14 '11 at 13:20
-
ás: Thanks for sharing: I learned some new things from your comment that will come in handy if I ever get around to writing some software of my own! – Firefeather May 17 '11 at 18:33
-
I'm glad it helps you :) – Tamás Szelei May 17 '11 at 18:56
-
Related : http://askubuntu.com/questions/59822/where-to-store-user-settings-for-an-app – Tachyons Oct 05 '12 at 14:59
1 Answers
12
If you are talking about a system wide daemon, a file in /etc
is appropriate. If you are talking about an application that should have per-user settings, the home directory is appropriate. For new apps, it would be a good idea to follow the XDG Base Directory specification:
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
This basically states that you should store your config files in $XDG_CONFIG_HOME
, which defaults to ~/.config

James Henstridge
- 41,136