09-06-2023, 09:41 AM
Unsetting the Value of a Linux Environment Variable
We'll be using the unset command. Let’s see how the command’s syntax looks, and break it down:
unset VAR
The parts of the command are:
- unset – the command itself
- VAR – the variable we want to unset
Simple, right? We’ll unset the timezone variable as a test:
unset TZ
This will take the time zone to its default value, which we can check by using the date command once more.
Setting and unsetting a Linux environmental variable from the command line affects only your current running sessions. If you want to make your settings persist between logins, you have to define the environment variables in your personal initialization file – i.e., .bash_profile.

