Print the value of specific environment variables.
low risk
printenv prints the values of specified environment variables, or all variables if none are specified. Unlike env, it's purpose-built for querying — cleaner for scripting than parsing env output.
printenv HOMEPrint the home directory path · explain & risk-check →printenv PATHPrint the current PATH · explain & risk-check →printenv | sortList all env vars alphabetically · explain & risk-check →printenv KUBECONFIG 2>/dev/null || echo 'Not set'Safely check if a var is set · explain & risk-check →In scripts, prefer `printenv VAR` over `echo $VAR` — the latter can be confusing if the variable contains special characters.
Reference text is hand-written and may be incomplete — check man printenv for your version. Test destructive commands on a non-production system first.