Ad space (banner)
🖥️Linux Lessons
Lesson 53 / 61

Listing Environment Variables with env

env is for when "I want to see every environment variable set in the current shell, all at once." env lists every environment variable set in the current shell session.

Just type env alone to display every environment variable. It's similar to printenv, but env also has the ability to run a command in a modified environment.

Running env lists every currently-set environment variable — things like PATH and HOME — in name=value format.

A common early mistake is worrying too much about the difference from printenv — for simple listing purposes, either one gives you nearly the same result.

In real work, using something like env variable=value command to temporarily change just one environment variable while running a command is a pattern commonly seen in CI/CD environments.

Linux
Try it (type this into the pseudo terminal)
env

🧑‍💻 You can type this command into the Linux pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)