Environment variables are one of the most fundamental concepts in Linux. They provide a way for the operating system and applications to store and retrieve configuration information without modifying application code.
Instead of hardcoding values like usernames, file locations, API endpoints, or executable paths, Linux stores these values in environment variables that applications can access whenever they run.
This approach makes software more portable, configurable, and secure.
An environment variable is a named value stored by the operating system.
Its format is:
NAME=value
Examples:
USER=chukwuemeka-peter-eze
HOME=/home/chukwuemeka-peter-eze
SHELL=/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin
Every process inherits environment variables from its parent process, allowing applications to share configuration consistently.
Environment variables are important because they: