Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →To list exported environment variables in the current Linux process, run printenv. You can also run env with no arguments. In Bash, use set when you need shell variables that have not been exported as well as functions.
List exported environment variables
Open a terminal and run:
printenv
With no variable name, printenv prints the names and values of the environment entries available to it, one per line. To show just one variable, pass its name:
printenv PATH
The output reflects the environment of the process running the command—not a master list of everything configured on the machine.
Use env as an alternative
Running env without arguments also displays the current environment:
#1 Best Overall
env
env is especially useful when you want to change the environment for a child command. For example, start a command with an empty environment using env -i command, or remove a variable for that command using env -u NAME command. These changes apply to the command launched by env; they do not permanently change the parent shell’s environment.
Choose the right command
| Command | What it shows or does | Scope and delimiter |
|---|---|---|
printenv |
Displays exported environment entries; with a variable name, displays that entry. | Current process environment; newline-delimited by default. printenv -0 uses NUL delimiters. |
env |
Displays the environment with no command, or runs a command with environment changes such as -i or -u. |
Current process environment for display; newline-delimited by default. env -0 uses NUL delimiters. |
set |
In Bash, reports shell variables and functions as well as exported variables. | Bash shell state; output may be extensive and include function definitions. |
These commands do not produce identical output. printenv is the direct choice for exported variables, while Bash’s set covers additional shell state.
Rank #2
Include Bash variables that are not exported
A shell variable is inherited by child processes only when it is exported. To inspect Bash variables that remain local to the shell, along with exported variables and functions, run:
set
Because set output can be large and may contain function definitions, use it only when you need that broader Bash view. It is not a substitute for printenv if you specifically want the exported process environment.
Rank #3
Handle values that contain newlines
The default output uses a newline to separate entries. If you are processing the output and a value might itself contain a newline, use NUL-delimited output instead:
printenv -0
env -0 provides the same delimiter option. NUL separators avoid confusing a newline inside a value with the boundary between two entries.
Rank #4
Understand which environment you are seeing
Environment variables belong to processes. A child process normally inherits its parent’s exported variables, but an unexported shell variable remains in that shell. The names and values present depend on the shell, distribution, login method, startup configuration, and installed software. Configuration may come from sources such as /etc/environment, /etc/profile, and per-user startup files.
To inspect another running process, use a diagnostic method for that process—for example, /proc/<pid>/environ where permissions allow. Running printenv in your terminal shows the environment of the process running it, not every process on the system. There is no fixed universal number or list of Linux environment variables.
Recommended Free Tools
Best Value
Protect sensitive values
Environment output may contain credentials, tokens, or connection strings. Before pasting command output into a log, support request, or public post, review it and redact sensitive values.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

