1. Open a terminal and type the following:

echo “export HISTSIZE=10”

  1. Type the following to change the value of $HISTSIZE in your “.bashrc” file:

echo “export HISTSIZE=100”

Steps to List Environment Variables on Linux

Printenv is a powerful command that allows you to display environment variables. If no argument is given, Printenv prints a list of all environment variables.

The printenv command can be used to list all environment variables on a Linux system. ..

To list all of the variables in a script, use the following command: set | more ..

You can also check multiple variables simultaneously to get a more accurate picture of the situation.

When you want to interact with the environment variables in your terminal or when writing a script, you will need to precede them with a dollar sign $. ..

The $PATH variable lets you specify the directories Bash should search for programs when you enter a command. This can be useful if you want to run a specific program from a specific directory, or if you want to use a different program’s installation location when running Bash.

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.