Shell
printenv
Print all or specified environment variable values.
Synopsis
syntax
printenv [OPTION]... [VARIABLE]...
Examples
Print all environment variables
printenv
Print value of HOME
printenv HOME
Print specific variables
printenv PATH USER SHELL
Print all variables sorted alphabetically
printenv | sort
Common options
| Flag | Description |
|---|---|
| -0 | NUL-separated output |
About printenv
The `printenv` command print all or specified environment variable values. Shell commands configure your interactive environment — variables, aliases, history, and shell options.
The shell is your primary interface with Linux, and customizing it improves productivity. These commands work across bash, zsh, and other POSIX-compatible shells with minor differences.
The command accepts 1 commonly used flag shown above, though the full set of options is available in the man page (`man printenv`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Shell Commands
Other commands in the Shell category