A quick guide to the printenv command, used to print the values of environment variables

In any shell there are a good number of environment variables, set either by the system, or by your own shell scripts and configuration.

You can print them all to the terminal using the printenv command. The output will be something like this:


with a few more lines, usually.

You can append a variable name as a parameter, to only show that variable value:

printenv PATH

The printenv command works on Linux, macOS, WSL, and anywhere you have a UNIX environment

Download my free Linux Commands Handbook

More cli tutorials: