I am writing my application foo, with frontend foo-gtk.

I want to install a default/systemwide config file, which I infer would go under /etc/foo.conf, and possible /etc/foo-gtk.conf for default gui settings.

I am far more confused about user specific config files.

Here are places I see config files for other applications:

  • ~/.foo.conf
  • ~/.foo/config
  • ~/.config/foo/config

The first has the advantage of being quick to get to if the user needs to edit it a lot, But the next two seem roughly equivalent.

I haven't found any formal spec on this so I'm curious, what is best practice for storing/locationof application Defualt, SystemWide, and Per-user config files?


The latest best practice is not to embed the user config file under a hidden user directory unless there will be more than one user specific file for the application. Thus, you should use only ~/.fooconfig (or ~/.foorc) for the user resource file for foo.

If foo has multiple user files, then it's ~/.foo/config for the configuration file along with any other files, all under ~/.foo/

  • 2
    Afaik, the latest best practice as per FDO spec is to use $XDG_CONFIG_HOME which if not set defaults to $HOME/.config. – don_crissti May 21 '15 at 16:02
  • 1
    XDG is creating a directory at ~/.config - but this (appears) specific to XDG (desktop) applications - not "all" applications. https://wiki.archlinux.org/index.php/Xdg_user_directories IMHO XDG creating a generic ~/.config directory (for instance, not ~/.xdg/ directory) is only best practice for XDG - but I would hazard to say it is not best practice for 'all' applications. – Andrew May 21 '15 at 16:09
  • 2
    Not sure what you mean by "best practice for XDG"... Do you mean GUI apps ? Not really... XDG specs were born in the X world, indeed, but that doesn't mean they only apply to GUI apps. "best practice" is subjective and OP said "I haven't found any formal spec" hence my comment. Example of FDO/XDG compliant app (with daemon, cli and gui components) : transmission config files. For the record, I have stuff under .config that belongs to pulse, imagemagick etc (none of these is a gui app). – don_crissti May 21 '15 at 16:56
  • 1
    So, to use ssh, I suppose ~/.config/.ssh/id_rsa makes sense if you consider 'XDG' to be implementing 'best practices'. Regardless, I'm going with what ssh, git, kde, gnome and most applications do, use a .<application name>config file or a .<application name> directory under the user's home directory. This will preserve XDG's generic ~/.config implementation for developers who trust their configs won't get trampled by files with the same name in a shared directory. – Andrew May 21 '15 at 18:01

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.