List of Environment Variables in Linux/Unix

In this tutorial, you will learn-

What is a Computing Environment?

The Computing environment is the Platform(Platform = Operating System+ Processor) where a user can run programs.

What is a Variable?

In computer science, a variable is a location for storing a value which can be a filename, text, number or any other data. It is usually referred to with its Symbolic name which is given to it while creation. The value thus stored can be displayed, deleted, edited and re-saved.

Variables play an important role in computer programming because they enable programmers to write flexible programs. As they are related to the Operating system that we work on, it is important to know some of them and how we can influence them.

What are Environment variables?

Environment variables are dynamic values which affect the processes or programs on a computer. They exist in every operating system, but types may vary. Environment variables can be created, edited, saved, and deleted and give information about the system behavior.

Environment variables can change the way a software/programs behave.

E.g. $LANG environment variable stores the value of the language that the user understands. This value is read by an application such that a Chinese user is shown a Mandarin interface while an American user is shown an English interface.

Let's study some common environment variables -

Variable
VARIABLE_NAME= variable_value

Again, bear in mind that variables are case-sensitive and usually they are created in upper case.

Linux - Environment Variables

Deleting Variables

The following syntax can be used to remove a Variable from the system.

unset variablename

Linux - Environment Variables

This would remove the Variable and its value permanently.

Summary:

  • Environment variables govern the behavior of programs in your Operating System.
Command Description
echo $VARIABLE To display value of a variable
env Displays all environment variables
VARIABLE_NAME= variable_value Create a new variable
unset   Remove a variable
export Variable=value To set value of an environment variable

 

gtupapers is Sponsored by Acunetix
Acunetix

Acunetix, the developers of dead-accurate web application security scanners have sponsored the gtupapers project to help scan for over 4500 web vulnerabilities accurately and at top speed.