44

There are a number of hidden configuration files in my home directory:

  • some of them are in ~/ (e.g. ~/.cinnamon)
  • some of them are in ~/.config/ (e.g. ~/.config/cinnamon-session)
  • some of them are in ~/.local/share/ (e.g. ~/.local/share/cinnamon-session)

What is the logic as to where home configuration files live?

a) What is the difference between hidden files in these three places?

b) What exactly does "local" mean in this context, vs config, vs home?

c) In the home directory, are there also other important common configuration directories used by multiple applications?


Debian 8.6 Cinnamon 2.2.16

1

1 Answer 1

49

There's a long history here when it comes to the general case of "dot files", but the $HOME/.config and $HOME/.local directories that you specifically mention have an origin in the XDG Base Directory Specification.

  • $HOME/.config is where per-user configuration files go if there is no $XDG_CONFIG_HOME.
  • $HOME/.cache is where per-user cache files go if there is no $XDG_CACHE_HOME.
  • $HOME/.local/share is where per-user data files go if there is no $XDG_DATA_HOME.

Windows users may recognize this as a parallel of what Microsoft has had in Windows NT since version 4 (albeit that the names changed in version 6.0):

  • %USERPROFILE%/AppData/Local/ a.k.a. %LOCALAPPDATA% — where per-user data files for this machine go
  • %USERPROFILE%/AppData/Roaming/ a.k.a. %APPDATA% — where per-user data files that a roaming user can access from multiple machines go
  • %USERPROFILE%/AppData/Local/Temp/ a.k.a. %TEMP% — where per-user temporary files go

The idea is that per-user files can be (amongst quite a lot of other things) application data files (machine-specific or roaming), application configuration files, cached files, and temporary files, and applications place them in subtrees rooted at these particular directories.

(MacOS has a similar system where users get individual per-user "user local" subtrees under /var/folders with C and T subdirectories for cache and temporary files.)

As the Arch people note, there are some "dot" files and directories that have become commonly used by several applications and are unlikely to agree with XDG in the foreseeable future, such as $HOME/.ssh and $HOME/.netrc .

Further reading

4
  • 2
    XDG stands for "Cross Desktop Group" and defines a standard for various desktop environments. Dec 29, 2022 at 14:52
  • Any idea why .local/share is a 2-level deep directory structure while the others are stored directly in the $HOME dir?
    – marcus
    Mar 14 at 16:05
  • @marcus as the XDG specificationn, under .local you have 3 base directories by default: share, local, and bin. Files there are local to your machine and user, so they are not portable. Files under .config should in principle be portable.
    – zazke
    Nov 24 at 6:22
  • Thanks for your insight, that might be the reason. However, wouldn't .local/share then be a contradiction, i.e. an oxymoron? "share" is supposed to be a location for data file that can be shared between machines (icons, documentation or in other words anything but binary executables and cache) while .local would mean you can't take those file with you to another machine...?
    – marcus
    Nov 24 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .