13

From a developer's perspective. Should I use a text-based config in /etc or in $HOME? Or something else?

5
  • I lack the expertise to know whether they would be preferred or not, but GConf and dconf are other ways to store application settings. May 13 '11 at 21:17
  • 1
    Thanks 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. 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! May 17 '11 at 18:33
  • I'm glad it helps you :) May 17 '11 at 18:56
  • Related : askubuntu.com/questions/59822/…
    – Tachyons
    Oct 5 '12 at 14:59
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

1
  • Why no mention of dconf/gsettings?
    – Seth
    Apr 2 '15 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.