env
List environment variables
What it does
With no arguments env prints every environment variable as NAME=value: PATH, HOME, USER, LANG and the ones you set with export. The list is long, so it is usually filtered: env | grep PATH.
printenv does the same, and printenv HOME shows a single variable. With arguments, env runs a command with changed variables: env NODE_ENV=test npm test.
Syntax
env
env | grep <text>
env <NAME>=<value> <command>Examples
Find the environment variables that contain PATH
env | grep PATHsame as:
printenv | grep PATHenv— all environment variables| grep PATH— filter them