On each of our test computers, there are often 50 different environmental factors. Like any other variable, an environment variable consists of a name and a value. The name is distinct, given during variable creation, and it remains in effect for the duration of the environment variable. For us, variables have meaning. A process looks for a variable by name in a list when it wants to know what the value is, then reads the value from it. Variable values can be altered despite the fact that their names cannot.
Although you won’t need it often, you can adjust the system environment variables. For instance, you might want to make your Bash shell command history cache larger. To change the maximum number of remembered commands, change the value of the $HISTSIZE environment variable in your “.bashrc” file. Although it’s convenient and neat, you won’t be doing that frequently. Environment variables are frequently ignored after being updated or are left at their default values. You won’t fiddle with them very much. We mentioned below are the steps to list Environment Variables on Linux.
Steps to List Environment Variables on Linux
Printenv is the most used command for displaying environment variables. Only that variable’s value is displayed if the variable’s name is supplied as an argument to the command. Printenv prints a list of all environment variables, one variable per line, if no argument is given.

$ printenv
$ printenv SHELL/bin/bash
$ printenv HOME SHELL/home/linuxconfig/bin/bash
$ echo “I am logged in as $USER with the $SHELL shell and my home directory is $HOME”I am logged in as linuxconfig with the /bin/bash shell and my home directory is /home/linuxconfig
$ printenv PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Final Words
Environment variables are a collection of dynamic named values that are saved on the system and utilized by programmes that are run in shells or subshells on Linux and Unix-based systems. An environment variable is, to put it simply, a variable with a name and a corresponding value. We hope our article on “How to List Environment Variables on Linux” will surely help you to do so.