distrobox-host-exec
Execute commands on the host from inside Distrobox
TLDR
Execute command on the host system from inside the Distrobox container
Execute the ls command on the host system from inside the container
SYNOPSIS
distrobox-host-exec [OPTIONS] [--] COMMAND [ARGS...]
PARAMETERS
-h, --help
Print help message and exit
-V, --version
Print version information and exit
-v, --verbose
Enable verbose output for debugging
DESCRIPTION
distrobox-host-exec enables seamless execution of host system binaries and commands directly from within a Distrobox container. It temporarily modifies the shell environment by prepending host binary paths (like /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin) to PATH, unsets container-specific variables (e.g., DBX_CONTAINER_HOME), and preserves essential host environment variables. This bridges container isolation with host capabilities, ideal for running hardware-specific tools like nvidia-smi, fwupdmgr, or systemctl without exporting the container or switching sessions.
Invoked as distrobox-host-exec <command> [args], it spawns a new shell process with adjusted env, exec'ing the command natively on host libraries. No container restart needed; works in any entered Distrobox. Useful for developers needing host GPU access, system monitoring, or package managers conflicting in containers.
CAVEATS
Graphical apps need X11/Wayland forwarding; host commands requiring non-exported mounts (e.g., /proc specific) may fail. Avoid for security-sensitive ops due to host privilege escalation potential.
EXAMPLES
distrobox-host-exec nvidia-smi
distrobox-host-exec fwupdmgr refresh
distrobox-host-exec systemctl --machine=foo status
HOW IT WORKS
Runs /usr/bin/env -i with host PATH/LD_LIBRARY_PATH, exec'ing command via container's bind-mounted host bins.
HISTORY
Introduced in early Distrobox releases (~2021, v1.2+) by Luca Weichselbaumer (89luca89) to enhance host-container integration, evolving with OCI backend support.
SEE ALSO
distrobox(1), distrobox-enter(1), podman-run(1)


