Files
oam/knowledge base/xdg base directory.md

4.4 KiB

XDG base directory specification

Table of contents

  1. TL;DR
  2. Further readings
  3. Sources

TL;DR

Environment variable Type Description Default value
XDG_CONFIG_HOME Single directory User-specific configuration files $HOME/.config
XDG_CACHE_HOME Single directory User-specific non-essential (cached) data $HOME/.cache
XDG_DATA_HOME Single directory User-specific data files $HOME/.local/share
XDG_STATE_HOME Single directory User-specific state data that should persist between application restarts, but not important or portable enough to be stored in $XDG_DATA_HOME like actions history (logs, history, recently used files, …) or current states (view, layout, open files, undo history, …) $HOME/.local/state
Single directory User-specific executable files, should be included in the UNIX $PATH environment variable at an appropriate place $HOME/.local/bin
XDG_DATA_DIRS Set of preference ordered directories Search folders for data files in addition to the $XDG_DATA_HOME base directory; such directories should be separated with a colon (:) /usr/local/share/:/usr/share/
XDG_CONFIG_DIRS Set of preference ordered directories Search folders for configuration files in addition to the $XDG_CONFIG_HOME base directory; such directories should be separated with a colon (:) /etc/xdg
XDG_RUNTIME_DIR Single directory User-specific non-essential runtime files and other file objects such as sockets, named pipes, …; the directory must live and die with the user's session, must be owned and accessible (0700) only by the user and must reside on the local disk

All paths set in these environment variables must be absolute. By specification, if an implementation encounters a relative path in any of these variables it should consider the path invalid and ignore it.

Further readings

Sources

All the references in the further readings section, plus the following: