What is the preferred way to store application settings?

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


Solution 1:

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