Kolam Ayer MakersLinux Foundations

Environment Variables

Core Idea

Environment variables are name-value strings passed from a parent process to a child process. They are how shells tell programs about context such as home directory, username, editor, locale, and command search paths.

Commands To Try

env
printf '%s\n' "$HOME"
printf '%s\n' "$USER"
printf '%s\n' "$PATH"

PATH is a colon-separated list of directories the shell searches when you type a command name. If a script says command not found, PATH is one of the first things to inspect.

Local Variables Versus Environment

name='Ada'
export name

A plain shell variable is available to the shell. An exported variable is passed to child processes.

Common Confusions

Proof Check

Run env | grep '^PATH=', then use command -v python3 to prove the shell found python3 through that search path.

Docs Pointers