$XDG_RUNTIME_DIR
also: XDG_RUNTIME_DIR, XDG runtime directory
An environment variable that points to a user's runtime directory, typically used for temporary files, sockets, and other runtime data that should not persist across reboots.
$XDG_RUNTIME_DIR is defined by the XDG Base Directory specification and provides a standardized location for per-user runtime files. On most modern Linux systems, it defaults to /run/user/UID, where UID is the user's numeric ID.
The directory is created with restrictive permissions (700) so only the owner can access it, making it suitable for storing sensitive runtime data like D-Bus sockets, SSH agents, and temporary authentication tokens. For example, systemd user services store their sockets in $XDG_RUNTIME_DIR.
This directory is typically mounted as a tmpfs (in-memory filesystem) and is cleaned up automatically when the user logs out, ensuring no stale files accumulate. It differs from $XDG_CONFIG_HOME and $XDG_DATA_HOME, which store persistent configuration and data.