Linux command: printenv

Quick startprintenvCommand to print the value of environment variable

Quick startprintenvCommand to print the value of environment variable

In any shell program, there are many environment variables. These variables can be set by the system or by your own shell script and configuration.

You can print them all to the terminal with the following commandprintenvcommand. The output will be like this:

HOME=/Users/flavio
LOGNAME=flavio
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
PWD=/Users/flavio
SHELL=/usr/local/bin/fish

There are usually several lines.

You can append the variable name as a parameter to display only the variable value:

printenv PATH

ThisprintenvThis command can be used in Linux, macOS, WSL and wherever you have a UNIX environment

Download mine for freeLinux Command Manual


More cli tutorials: