XDG user directories

From ArchWiki
Revision as of 04:26, 5 December 2012 by Thebodzio (Talk | contribs) (Fixed a typo in config file name with settings for one user (.dir -> .dirs) and added information about disabling directories)

Jump to: navigation, search

User directories are a set of common directories such as downloads directory, music directory, documents directory, and so on. These directories can have special identifying icons and used internally by many applications such as Nautilus and Thunar to determine where to look for files to be passed to the Create Document context menu, whereas the desktop directory is used by Xfdesktop to find .desktop files to be shown on the Desktop.


install package xdg-user-dirs from Official Repositories.


The config file

xdg-user-dirs uses two files for configuration:

  • For all users : /etc/xdg/user-dirs.defaults.
  • For one specific user: ~/.config/user-dirs.dirs.

Its format is as follows:


A complete file might contain multiple entries:


Pointing any of the above variables to $HOME effectively disables this specific directory (it won't be automatically created or recreated).


xdg-user-dirs-update is a desktop-independent tool for configuring the location of certain user directories. It is run very early in the login phase. This program reads a configuration file, and a set of default directories. It then creates localized versions of these directories in the users home directory and sets up a config file in $(XDG_CONFIG_HOME)/user-dirs.dirs (XDG_CONFIG_HOME defaults to ~/.config) that applications can read to find these directories.

As an example, command

xdg-user-dirs-update --set TEMPLATES ~/.templates

will set the template directory to the specified directory with respect to the current user's $HOME:



Once set, any user directory can be viewed with xdg-user-dir. For example:

$ xdg-user-dir TEMPLATES

will show the template directory, which of course corresponds to the XDG_TEMPLATES_DIR variable in the config file.

External Resource