in

How to View/List all Environment Variables in Linux/Unix

You can use the following commands in Linux and Unix to list or view the environment variables. With the same command you can view a particular environment variable in Linux/Unix and to list all environment variables in Linux/Unix operating systems. The below is the list of commands and their examples:
  • printenv
  • env
  • set
  • export
  • echo

To display all variables set in current environment you can use any of the following commands without any option e.g. printenv, env, set and export

The following example will list all environment variables in Linux or Unix shell:
$ printenv
If you know the particular variable name then you can view the content of that variable with printenv command as following:
$ printenv USER
You can use echo command also to view the content of an environment variable but in echo command you have to use dollar sign ($) with variable names, as shown in following example:
$ echo $USER
list environment variables in Linux/Unix shell

Written by Vinish Kapoor

An Oracle Apex Consultant, Oracle ACE, and founder of foxinfotech.org and orclqa.com a question and answer forum for developers.

guest

0 Comments
Inline Feedbacks
View all comments