From b2eaa0fc8692392171b45cb61462d05b0407e8be Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Tue, 6 Jun 2023 21:37:52 +0200 Subject: [PATCH] feat: article about xdg base directories --- knowledge base/xdg base directory.md | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 knowledge base/xdg base directory.md diff --git a/knowledge base/xdg base directory.md b/knowledge base/xdg base directory.md new file mode 100644 index 0000000..2550eb6 --- /dev/null +++ b/knowledge base/xdg base directory.md @@ -0,0 +1,42 @@ +# XDG base directory specification + +## Table of contents + +1. [TL;DR](#tldr) +1. [Further readings](#further-readings) +1. [Sources](#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 + +- [Specifications] + +## Sources + +- [Arch Linux Wiki page] + +All the references in the [further readings] section, plus the following: + + +[specifications]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html + + +[further readings]: #further-readings + + + +[arch linux wiki page]: https://wiki.archlinux.org/title/XDG_Base_Directory