Skip to main content

Environment Variables

This page documents all environment variables relevant to the ADL desktop environment, organized by category.

Display Variablesโ€‹

Variables that control how graphical output is rendered.

VariableDefault ValuePurposeExample
DISPLAY:0 or :1X11 display server connectionexport DISPLAY=:1
WAYLAND_DISPLAYwayland-0Wayland compositor socket nameexport WAYLAND_DISPLAY=wayland-0
XDG_SESSION_TYPEx11Session type identifier (x11, wayland, tty)export XDG_SESSION_TYPE=wayland
โ„น๏ธNote

When running a nested X server (such as Xephyr), set DISPLAY to the nested display number to direct applications into it.

Audio Variablesโ€‹

Variables that configure audio routing and device selection.

VariableDefault ValuePurposeExample
PULSE_SERVERtcp:127.0.0.1:4713 or unix:/tmp/pulse-socketPulseAudio server addressexport PULSE_SERVER=tcp:127.0.0.1:4713
AUDIODEV(none)Preferred audio output deviceexport AUDIODEV=/dev/snd/pcmC0D0p
โœ…๐Ÿ’ก Android audio bridging

On Termux, set PULSE_SERVER to point at the Android host's PulseAudio daemon so that desktop applications can produce sound through the device speakers.

XDG Base Directoriesโ€‹

Standardized directories for application data, configuration, and caches.

VariableDefault ValuePurposeExample
XDG_DATA_HOME$HOME/.local/shareUser-specific data filesexport XDG_DATA_HOME=$HOME/.local/share
XDG_CONFIG_HOME$HOME/.configUser-specific configurationexport XDG_CONFIG_HOME=$HOME/.config
XDG_CACHE_HOME$HOME/.cacheUser-specific non-essential cached dataexport XDG_CACHE_HOME=$HOME/.cache
XDG_STATE_HOME$HOME/.local/stateUser-specific state data (logs, history)export XDG_STATE_HOME=$HOME/.local/state
XDG_RUNTIME_DIR/run/user/$UIDRuntime files (sockets, PIDs)export XDG_RUNTIME_DIR=/tmp/runtime-user
XDG_DATA_DIRS/usr/local/share:/usr/shareSystem-wide data search pathexport XDG_DATA_DIRS=/usr/local/share:/usr/share
XDG_CONFIG_DIRS/etc/xdgSystem-wide configuration search pathexport XDG_CONFIG_DIRS=/etc/xdg
XDG_CURRENT_DESKTOP(none)Current desktop environment nameexport XDG_CURRENT_DESKTOP=XFCE
XDG_SESSION_DESKTOP(none)Desktop session identifierexport XDG_SESSION_DESKTOP=xfce
โš ๏ธWarning

XDG_RUNTIME_DIR must be owned by the user, have permissions 0700, and reside on a local filesystem. Applications may fail if this directory is missing or misconfigured.

Path Variablesโ€‹

Variables that control executable and library lookup paths.

VariableDefault ValuePurposeExample
PATH/usr/local/bin:/usr/bin:/binExecutable search pathexport PATH=$HOME/.local/bin:$PATH
LD_LIBRARY_PATH(none)Shared library search pathexport LD_LIBRARY_PATH=/opt/lib:$LD_LIBRARY_PATH
PKG_CONFIG_PATH(none)pkg-config metadata search pathexport PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
MANPATH(system default)Manual page search pathexport MANPATH=$HOME/.local/share/man:$MANPATH
โญBest Practice

Always prepend to PATH rather than replacing it. Use export PATH=$HOME/.local/bin:$PATH to add directories without losing system defaults.

Termux-Specific Variablesโ€‹

Variables set automatically by Termux or required for compatibility with the Android environment.

VariableDefault ValuePurposeExample
PREFIX/data/data/com.termux/files/usrTermux root prefix for installed packagesecho $PREFIX
HOME/data/data/com.termux/files/homeUser home directory in Termuxcd $HOME
TMPDIR/data/data/com.termux/files/usr/tmpTemporary file directoryexport TMPDIR=$PREFIX/tmp
ANDROID_ROOT/systemAndroid system partition rootecho $ANDROID_ROOT
ANDROID_DATA/dataAndroid data partition rootecho $ANDROID_DATA
โ„น๏ธNote

These variables are set by Termux at shell startup. Overriding them may break package management and other Termux utilities.

Locale and Languageโ€‹

Variables that control language, character encoding, and regional formatting.

VariableDefault ValuePurposeExample
LANGC.UTF-8Default locale for all categoriesexport LANG=en_US.UTF-8
LC_ALL(none)Override for all LC_* categoriesexport LC_ALL=en_US.UTF-8
LANGUAGE(none)Ordered list of preferred languagesexport LANGUAGE=en_US:en
LC_CTYPE(from LANG)Character classification and conversionexport LC_CTYPE=en_US.UTF-8
LC_MESSAGES(from LANG)Language of system messagesexport LC_MESSAGES=en_US.UTF-8
LC_NUMERIC(from LANG)Numeric formattingexport LC_NUMERIC=en_US.UTF-8
LC_TIME(from LANG)Date and time formattingexport LC_TIME=en_US.UTF-8
LC_COLLATE(from LANG)String collation orderexport LC_COLLATE=en_US.UTF-8
โœ…๐Ÿ’ก Tip

Set LANG to configure all locale categories at once. Use individual LC_* variables only when you need a specific category to differ from the default.

Application Variablesโ€‹

Variables that define default applications for common tasks.

VariableDefault ValuePurposeExample
EDITORnanoDefault text editor (terminal)export EDITOR=vim
VISUAL(none)Preferred visual/GUI editorexport VISUAL=code
BROWSER(none)Default web browserexport BROWSER=firefox
TERMINAL(none)Default terminal emulatorexport TERMINAL=xfce4-terminal
PAGERlessDefault pager for long outputexport PAGER=less
SHELL/bin/bashCurrent user shellexport SHELL=/bin/bash

Setting Variables Permanentlyโ€‹

Where to place environment variable definitions so they persist across sessions.

FileScopeWhen Loaded
~/.bashrcCurrent user, interactive bash shellsEach new interactive shell
~/.profileCurrent user, login shellsLogin (console, SSH, display manager)
/etc/environmentAll usersPAM session initialization
/etc/profile.d/*.shAll users, login shellsLogin shells (sourced by /etc/profile)

For a single user, add exports to ~/.profile for login-time variables and ~/.bashrc for interactive shell settings:

$echo 'export EDITOR=vim' >> ~/.profile

For system-wide variables, create a file in /etc/profile.d/:

$echo 'export EDITOR=vim' | sudo tee /etc/profile.d/adl-defaults.sh
โญBest Practice

Use ~/.profile for variables that should apply to your entire session (including graphical applications launched from a display manager). Reserve ~/.bashrc for shell-specific aliases and functions.

Checking Current Valuesโ€‹

Commands for inspecting environment variables.

CommandPurposeExample
echo $VARPrint a single variableecho $DISPLAY
printenv VARPrint a single variable (no $ prefix)printenv HOME
printenvList all exported variablesprintenv | sort
envList all variables (similar to printenv)env | grep XDG
exportList all exported variables with declarationsexport -p
setList all shell variables (exported and local)set | head -50

To verify a variable is set and exported:

$printenv DISPLAY

To search for all variables matching a pattern:

$env | grep -i audio
Troubleshooting unset variables

If a variable is not set as expected:

  1. Confirm the variable is exported, not just assigned: use export VAR=value, not just VAR=value.
  2. Check which startup file is being sourced. Non-login shells skip ~/.profile.
  3. Verify there are no typos or conflicting assignments later in your shell configuration.
  4. For graphical sessions, ensure the variable is set before the desktop environment starts, not only in ~/.bashrc.