An environment variable is a named value that the operating system passes from one process to the programs it launches. The POSIX Base Specifications, in Chapter 8 (Environment Variables), describe the environment as an array of strings, each of the form name=value, made available to a program when it begins execution. The chapter specifies that variable names cannot contain the byte for the = character, and that for portability values should be composed of bytes from the portable character set, excluding the NUL byte.
The defining property of the environment is inheritance. When a process creates a child, the child receives a copy of the parent’s environment, and through exec that environment travels into the new program. POSIX states that the named variables, if present during execution, carry their specified meanings, that some are placed in the environment by the implementation at login, and that all may be added or changed by the user or any ancestor process. This is how a setting made once in a login shell silently reaches every command run afterward.
A handful of standard variables do much of the work. PATH is the list of directories the shell searches to find commands by name; HOME identifies the user’s home directory; variables such as LANG and the LC_ ones announce locale and language preferences. POSIX notes that the names of environment variables used by utilities consist solely of uppercase letters, digits, and the underscore, and do not begin with a digit, which is the convention that distinguishes them visually from ordinary lowercase identifiers.
In the shell, the bridge between a local shell variable and the inherited environment is the export operation. Assigning FOO=bar sets a variable visible only to the current shell; marking it exported places it in the environment block so that child processes receive it too. This distinction, local versus exported, is fundamental to how scripts configure the programs they invoke, and forgetting to export is a classic reason a setting fails to reach a subprocess.
Environment variables are central to how Unix-like systems are configured at runtime without recompiling anything. They let the same binary behave differently depending on context, point tools at the right files, and pass secrets and settings into containers and services. The mechanism is deliberately simple, just inherited name=value strings, which is why it has remained stable across decades and underpins so much of modern deployment, from twelve-factor apps to container orchestration.
Because the environment is copied rather than shared, a change in a child never propagates back up to its parent. This one-way, copy-on-exec model is easy to reason about and is exactly why environment variables are a safe, predictable channel for configuration rather than for communication between running processes.