This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!
XDG Base Directory Specification¶
The XDG Base Directory Specification defines where some files should be looked for by defining one or more base directories relative to which files should be located.
This specification defines a set of environment variables pointing programs to directories in which their data or configuration should be stored. This can be useful in order to try to take back control of our home directory.
Reference(s)
Table of contents¶
Install¶
Pre configure xdg
:
$ vi $HOME/.bashrc # or ${ZDOTDIR:-${HOME}}/.zshenv or wherever (⚠️ create it if not already present ⚠️ )
> ...
+ >
+ > # XDG
+ > export XDG_CONFIG_HOME="$HOME/.config"
+ > export XDG_CACHE_HOME="$HOME/.cache"
+ > export XDG_DATA_HOME="$HOME/.local/share"
> ...
$ source $HOME/.bashrc # or ${ZDOTDIR:-${HOME}}/.zshenv or wherever
Install xdg-user-dirs
:
Config¶
Configure your defaults folders and your defaults locales:
$ xdg-user-dirs-update
$ vi $HOME/.config/user-dirs.dirs
> ...
> XDG_DESKTOP_DIR="$HOME/desktop"
> XDG_DOWNLOAD_DIR="$HOME/downloads"
> XDG_TEMPLATES_DIR="$HOME/templates"
> XDG_PUBLICSHARE_DIR="$HOME/public"
> XDG_DOCUMENTS_DIR="$HOME/documents"
> XDG_MUSIC_DIR="$HOME/music"
> XDG_PICTURES_DIR="$HOME/pictures"
> XDG_VIDEOS_DIR="$HOME/videos"
> ...
$ vi $HOME/.config/user-dirs.locale
> ...
> en_US ISO-8860-1
> en_US.UTF-8 UTF-8
> fr_FR ISO-8859-1
> fr_FR@euro ISO-8859-15
> fr_FR.UTF-8 UTF-8
> ...
If this cheat sheet has been useful to you, then please consider leaving a star here.