09-06-2023, 09:28 AM
How to Create a New Linux Environment Variable
The basic syntax of this command would look like this:
export VAR="value"
Let’s break it down:
- export – the command used to create the variable
- VAR – the name of the variable
- = – indicates that the following section is the value
- “value” – the actual value
In a real-world scenario, the command could look like this:
export edward="hostinger"
Let’s see how we could change the value of the TZ – timezone – variable:
- First, let’s view the time:
date
The command will output the current time.
- Then we can use the export command to alter the timezone:
export TZ=”US/Pacific”
Now that the variable’s value was changed, we can check the time again by using the date command, which would output a different time appropriate to the changes made to the Linux environment variable.

