printenv [OPTION]... [VARIABLE]...
Introduction
Print the values of the specified environment VARIABLE
(s).
If no VARIABLE
is specified, print name and value pairs for them all.
Options
The only option is:
-0
,--null
: end each output line withNUL
, not newline (\n
)
It also has --help
and --version
options, like all the commands.
Note that your shell may have its own version of printenv
, which usually supersedes the version described here.
Please refer to your shell’s documentation.
Examples
# print the list of environmental variables
printenv
SHELL=/bin/bash
HOME=/home/pit
# many others
# print only certain variables
printenv USER HOME
pit
/home/pit
Quotes
Manual reference: