Top
Umesh Yadav
October 18, 2020 Updated Feb 3, 2026 Umesh

Linux Commands: printenv

printenv is used to print out the environment variables. Environment variables are a common form of setting global values across a terminal session. Environment variables can be set by the systems, automation scripts, or by the user. You can print yo...

printenv is used to print out the environment variables. Environment variables are a common form of setting global values across a terminal session. Environment variables can be set by the systems, automation scripts, or by the user.

You can print your all environment variables using just printenv.

Screenshot 2020-10-18 at 10.37.02 PM.png

If you want to print the value of a specific variable you can use printenv <variable name>.

Screenshot 2020-10-18 at 10.38.24 PM.png

Conclusion

If you are ever stuck and want to know what was the value of the environment variable you can use it. I have found myself using this quite often when debugging issues in production or on my local machine.