How to View Linux Environment Variables
You can see the entire list of environment variables on your Linux distribution by using the printenv command. The simple use of it on Ubuntu will provide a large output displaying the variables.
You can get a more manageable output by adding piping in a modifier:
printenv | less
Every line contains the name of the Linux environment variable followed by = and the value. For instance:
HOME=/home/edward
HOME is a Linux environment variable that has the value set as the /home/edward directory.
Environment variables are typically uppercase, though you can create lowercase environment variables as well. The output of printenv displays all environment variables in uppercase.
An important thing to note is that Linux environment variables are case sensitive. If you want to view the value of a specific environment variable, you can do so by passing the name of that variable as an argument to the printenv command. The entire string would look like this in the command line:
printenv HOME
Output:
/home/edward
Another way to display the value of an environment variable is by using the echo command like this:
echo $USER
Output:
Edward

