In this article, we want to show you environment variables in Linux.
Environment Variables are simply a set of predefined names that have a specific value that allows the Linux command line to understand what they mean.
Some of these variables are present in Linux by default, but Linux users can also create their own custom variables. You can see all of them by using the env command.
Environment Variables in Linux
These are some common environment variables that we bring for you:
Home is an environmental variable that indicates the user’s home directory.
In the command line we can enter the following command:
The path is a list of directories that are scanned when we run a command to find a program or script to find that program or script. Each directory in the PATH is separated from other directories using a: mark.
It shows where am I at this time.
It gives me the name of the logged-in user.
If you want to see the value inside the variable you can use HISTSIZE.
The HISTSIZE variable contains the number of commands stored in the history file.
This variable indicates the path of the current user shell, such as bash or zsh.
This variable indicates the default file editor used. This editor is the same editor used when typing edit in your terminal.
This variable shows the current ID process.
Also, we said that users can create their own environment variables.
Create environmental variables on Linux
Here we show you how to create a new environmental variable.
Tip: use capital letters.
MYMOOD=Happy echo $MYMOOD Happy
Here you create a new environmental variable named “MYMOOD”. In this way, you can create thousands of environmental variables.
Hope you enjoy this article about environment variables in Linux and stay tuned for more articles on the orcacore website.