Skip to content
Commitpedia
Log in Join & edit

What is an environment variable?

An environment variable is a named value the operating system passes to programs, such as settings or secrets.

Drafted with AI from official documentation. Scripts were run in a test environment and repository links verified. Awaiting a human check. Did it work for you? Last edited Outdated?

Edit history of What is an environment variable?: 1 recorded edit
Edit history · 1 edit
Type
Article
Edits
1
Editors
1
First issued
15 Oct 2026
Last edit
15 Oct 2026
Reading
1 min

An environment variable is a name and a value that live in the environment of a running process and are inherited by every program it starts. Think of sticky notes on the fridge that everyone in the house can read: HOME says where your files are, LANG which language to use, PATH where programs live.

Applications read configuration from them so the same code runs in development and production: DATABASE_URL, PORT, API_KEY. Docker, Kubernetes and CI systems all set them for your app. Files called .env hold them locally and should never be committed. In the shell you set one for the current session with export, or just for one command by prefixing it.

export APP_ENV=production
APP_ENV=test python app.py
printenv | sort

See also: What is PATH? and What is a token?

Did this work for you?

No votes yet. Be the first.

If it did not work, the report form below tells the editors what went wrong.

See also

  • 0049 Pipes and redirection: connecting commands A pipe sends one command's output into another command, and redirection sends output to a file. Together they let small tools build… Beginner · Explains an idea · Linux, macOS Article Basics · Text processing 15 Oct 2026
  • 0050 File permissions: chmod, chown and what 755 means Every file has an owner, a group and read/write/execute permissions for three kinds of users. chmod changes the permissions and chown changes… Beginner · Explains an idea · Linux, macOS Article Basics 15 Oct 2026
  • 0051 Environment variables and PATH Environment variables are named settings that every program inherits from the shell. PATH is the one that tells the shell where to… Beginner · Explains an idea · Linux, macOS Article Basics 15 Oct 2026
  • 0057 Shell cheat sheet: everyday commands A quick reference for moving around, managing files, viewing and searching text, checking processes and disk space in bash and zsh, with… Beginner · Cheat sheet · Linux, macOS Article Basics · Command-line tools 15 Oct 2026
  • 0284 What is a shell? A shell is the program that reads the commands you type and tells the operating system to run them. Beginner · Explains an idea · Any system Article Basics 15 Oct 2026
  • 0285 What is a terminal? A terminal is the window where you type commands; the shell inside it does the actual work. Beginner · Explains an idea · Any system Article Basics 15 Oct 2026

History

Every saved edit is kept. The plot on the sleeve draws one line per edit. Open any edit to see exactly what changed.

  1. Dominik +778 chars

Report a problem

Something wrong, unsafe or copied? Tell the editors.
What is wrong?