I've noticed that some applications put their configuration files to ~/.config/appname while others use ~/.appname (the classic way, AFAIK) for this. What's the sense in this distinction and what could be better to consider for an application of mine?

UPDATE: Looks like my (XUbuntu 11.10 default) $XDG_CONFIG_HOME is set to ~/ and the most of the applications in my system (like Mozilla Firefox, Adobe Flash Player, Midnight Commander, Opera, Wine, etc.) comply to this. But there are still many applications (like Compiz, Deadbeef, VLC, Qt Creator, Google Chrome, XFCE, etc.) using ~/.config/ instead. Another suspicious thing is that directories in ~/.config/ are not themselves hidden (no dot in their names) - aren't application config dirs expected to have constant own names without depending on the location ($XDG_CONFIG_HOME value)?


A complement to jasonwryan's great answer, addressing some of your issues:

  • Your $XDG_CONFIG_HOME is not set to ~/. It simply isn't set. So applications that follow the XDG Specification use the default ~/.config

  • The dirs inside /.config are not hidden because they don't have to. The whole point of using a ~/.config dir is to un-clutter the user's $HOME. Since they are already in a separate, hidden dir, there's no need to be hidden inside there.

  • Software that does not follow the spec (unfortunately still the vast majority) use a hidden dir for their settings (like ~/.myapp) as an attempt not to clutter the user's $HOME. It (kinda) works, but it is still a bad approach when, for example, you try to backup your settings and your "big data" (like Pictures, Videos, Music) separately. Having all settings in a single place, without mixing with user's data, is a much better approach

  • As for "having constant names regardless of where XDG_CONFIG_HOME points to" , they already do: it is appname without the leading dot. Remember: the ones using $HOME/.appname are the ones that ignore XDG Spec. They use a hardcoded path.

  • As for your applications, please use the XDG Standard! I beg you, and your users will say thanks for you not cluttering their $HOME any further.

| improve this answer | |
  • 4
    Just want to say your answer is most excellent! The conventional wisdom is particularly useful and your points are very well explained :) thanks! – Steve Benner Jan 23 '16 at 12:19
  • Where is the difference between a list of hidden files in the HOME directory and a list of non hidden files in a hidden configuration directory? For me it is as broad as it is long. – ceving Jul 21 '17 at 7:58
  • @ceving: I see 2 main differences, a cosmetic and a practical one: from your $HOME point of view, it's a single ~/.config entry instead of several, perhaps dozens of them. And it makes backups of your settings (or excluding them) much much easier! How can you tell apart software settings from, say, your ~/Documents or your ~/.cache? – MestreLion Jul 21 '17 at 10:29

Because those applications that place configuration files in $HOME are ignoring the XDG Base Directory Specification, notably:

There is a single base directory relative to which user-specific configuration files should be written. This directory is defined by the environment variable $XDG_CONFIG_HOME...

If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.
| improve this answer | |
  • Looks like my (XUbuntu 11.10 default) $XDG_CONFIG_HOME is set to ~/, but there are still many applications using ~/.config/ – Ivan Nov 11 '11 at 1:54
  • 4
    This answer is far from complete. Namely, it seems to imply that the specification has been there since day one, and it's just the apps which have ignored it since the beginning. But actually there are quite some apps which have been around for much longer than XDG with its specification. – Ruslan Jun 8 '16 at 7:17
  • A version 0.7 Poettering standard. That must be really important. Can anybody explain which problem the standard solves? – ceving Jul 21 '17 at 7:55
  • @Ruslan: It's been there since 2003. That's 15 years ago! True, that's not day one and many software was created before that. But any such software most likely had many updates to be still in use today, so it's safe to say the ones that didn't migrate to the XDG standard deliberately chose to ignore it. – MestreLion Mar 14 '18 at 4:34
  • 2
    @ceving: that's not true, dot files in user's HOME tree can also be logs (.xsession-errors), state/lock files (.gksu.lock), cache files, and even device/block files. Many of them you don't want to backup. – MestreLion Mar 14 '18 at 20:52

A more controversial answer is:

  • ~/.config is the default for the XDG standard, which only applies to applications adhering to the FreeDesktop.org standards (also via use of the $XDG_CONFIG_HOME variable).
  • ~/.appname existed before the freedesktop standard
  • Not everyone likes the freedesktop standard
  • "Cluttering" $HOME isn't a problem, in my opinion.
| improve this answer | |
  • 2
    That's not a controversial answer, it's a misleading and plain wrong one: - Currently I have 120 directories at ~/.config, from applications that have no relation to FreeDesktop.org, such as Libre Office, Chromium, Deluge, a lot of games (including but not only all games using Unity3D), Google apps (Chrome, Earth), Python stuff (IPython, Eric), Emulators (Muppen 64, Desmune). FreeDesktop.org itself has very few applications. - ~/.appname is a convention that existed before XDG, but most software still in use today was created way after the standard. – MestreLion Mar 14 '18 at 4:54
  • 6
    - From a software developer's perspective, there's nothing to like or dislike in a directory standard, it simply changes your save dir constant from $HOME/.myapp to ${XDG_CONFIG_HOME:-$HOME/.config}/myapp – MestreLion Mar 14 '18 at 4:57
  • Is still a freedesktop standard, defined here : specifications.freedesktop.org/basedir-spec/… and which applications are free not to use of they don't wish to. Not everyone considers the separation into .config necessary. – David Gardner Mar 15 '18 at 10:33
  • True, but implying that applications that follow the standard are somehow "FreeDesktop.org applications" is very misleading. – MestreLion Mar 15 '18 at 14:55
  • 2
    are there any benefits to ~/.app over ~/.config/app? – sam boosalis Apr 2 '19 at 22:46

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.