Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unsetting the Value of a Linux Environment Variable
#1

       
   

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.

   
   
   
   
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)