6

What's the default value for $XDG_DATA_HOME in Ubuntu 14.04? I get an empty line with:

echo $XDG_DATA_HOME

According to the Free Desktop Specifications, it might be equals to $HOME/.local/share

5

As report in XDG Base Directory Specification environment variables aren't set by default bug, Ubuntu doesn't set XDG variables.

According to FreeDesktop Base Directory Specification:

$XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.

Applications that implement this specification must implement this behaviour, so if $XDG_DATA_HOME is not defined they must use $HOME/.local/share as default.

There are some implementation of this specification, like: Glib, libghc-xdg-basedir-prof and pyxdg

If you want to override this value, you should define XDG variable in /etc/profile or better in /etc/profile.d as described in Where should the XDG_CONFIG_HOME variable be defined?

5

Here's how I set it in my ~/.bashrc:

export XDG_DATA_HOME=${XDG_DATA_HOME:="$HOME/.local/share"}

This keeps any value already set, else sets it to the default value specified in the XDG Base Directory Specification

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.