Not able to 'unset' environmental variable permanently - UBUNTU











up vote
3
down vote

favorite
1












I set environment variable using export CATALINA_HOME=/home/chirag/Softwares/apache-tomcat-7.0.56 before some time from the terminal.



But now i want to unset this variable premenantly.



I use unset CATALINA_HOME to remove that variable but when I open other terminal that variable is available with the same value.



How can I remove the 'env variable' permanently ?
Thanks in advance.










share|improve this question




















  • 1




    First you have to figure out where you set that variable in the first place. Do you know where you set it before? Simply setting it in the terminal is not enough to make a 'permanent' env variable
    – Thomas Ward
    May 17 '15 at 16:09












  • No I don't know where that variable is set at first time.
    – ckpatel
    May 17 '15 at 16:14










  • In my home directory I found .bashrc file and line export CATALINA_HOME=/home/chirag/Softwares/apache-tomcat-7.0.56 at the end of the file. So I remove that line ?
    – ckpatel
    May 17 '15 at 16:32










  • Thanks, I remove line containing CATALINA_HOME variable and it works.
    – ckpatel
    May 17 '15 at 16:48










  • Glad to hear it! I've moved my comments into an answer so you can accept it as the valid answer and mark the question as 'solved'.
    – Thomas Ward
    May 17 '15 at 17:55















up vote
3
down vote

favorite
1












I set environment variable using export CATALINA_HOME=/home/chirag/Softwares/apache-tomcat-7.0.56 before some time from the terminal.



But now i want to unset this variable premenantly.



I use unset CATALINA_HOME to remove that variable but when I open other terminal that variable is available with the same value.



How can I remove the 'env variable' permanently ?
Thanks in advance.










share|improve this question




















  • 1




    First you have to figure out where you set that variable in the first place. Do you know where you set it before? Simply setting it in the terminal is not enough to make a 'permanent' env variable
    – Thomas Ward
    May 17 '15 at 16:09












  • No I don't know where that variable is set at first time.
    – ckpatel
    May 17 '15 at 16:14










  • In my home directory I found .bashrc file and line export CATALINA_HOME=/home/chirag/Softwares/apache-tomcat-7.0.56 at the end of the file. So I remove that line ?
    – ckpatel
    May 17 '15 at 16:32










  • Thanks, I remove line containing CATALINA_HOME variable and it works.
    – ckpatel
    May 17 '15 at 16:48










  • Glad to hear it! I've moved my comments into an answer so you can accept it as the valid answer and mark the question as 'solved'.
    – Thomas Ward
    May 17 '15 at 17:55













up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





I set environment variable using export CATALINA_HOME=/home/chirag/Softwares/apache-tomcat-7.0.56 before some time from the terminal.



But now i want to unset this variable premenantly.



I use unset CATALINA_HOME to remove that variable but when I open other terminal that variable is available with the same value.



How can I remove the 'env variable' permanently ?
Thanks in advance.










share|improve this question















I set environment variable using export CATALINA_HOME=/home/chirag/Softwares/apache-tomcat-7.0.56 before some time from the terminal.



But now i want to unset this variable premenantly.



I use unset CATALINA_HOME to remove that variable but when I open other terminal that variable is available with the same value.



How can I remove the 'env variable' permanently ?
Thanks in advance.







14.04 environment-variables






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 17 '15 at 16:10









Thomas Ward

42.9k23119169




42.9k23119169










asked May 17 '15 at 16:08









ckpatel

12114




12114








  • 1




    First you have to figure out where you set that variable in the first place. Do you know where you set it before? Simply setting it in the terminal is not enough to make a 'permanent' env variable
    – Thomas Ward
    May 17 '15 at 16:09












  • No I don't know where that variable is set at first time.
    – ckpatel
    May 17 '15 at 16:14










  • In my home directory I found .bashrc file and line export CATALINA_HOME=/home/chirag/Softwares/apache-tomcat-7.0.56 at the end of the file. So I remove that line ?
    – ckpatel
    May 17 '15 at 16:32










  • Thanks, I remove line containing CATALINA_HOME variable and it works.
    – ckpatel
    May 17 '15 at 16:48










  • Glad to hear it! I've moved my comments into an answer so you can accept it as the valid answer and mark the question as 'solved'.
    – Thomas Ward
    May 17 '15 at 17:55














  • 1




    First you have to figure out where you set that variable in the first place. Do you know where you set it before? Simply setting it in the terminal is not enough to make a 'permanent' env variable
    – Thomas Ward
    May 17 '15 at 16:09












  • No I don't know where that variable is set at first time.
    – ckpatel
    May 17 '15 at 16:14










  • In my home directory I found .bashrc file and line export CATALINA_HOME=/home/chirag/Softwares/apache-tomcat-7.0.56 at the end of the file. So I remove that line ?
    – ckpatel
    May 17 '15 at 16:32










  • Thanks, I remove line containing CATALINA_HOME variable and it works.
    – ckpatel
    May 17 '15 at 16:48










  • Glad to hear it! I've moved my comments into an answer so you can accept it as the valid answer and mark the question as 'solved'.
    – Thomas Ward
    May 17 '15 at 17:55








1




1




First you have to figure out where you set that variable in the first place. Do you know where you set it before? Simply setting it in the terminal is not enough to make a 'permanent' env variable
– Thomas Ward
May 17 '15 at 16:09






First you have to figure out where you set that variable in the first place. Do you know where you set it before? Simply setting it in the terminal is not enough to make a 'permanent' env variable
– Thomas Ward
May 17 '15 at 16:09














No I don't know where that variable is set at first time.
– ckpatel
May 17 '15 at 16:14




No I don't know where that variable is set at first time.
– ckpatel
May 17 '15 at 16:14












In my home directory I found .bashrc file and line export CATALINA_HOME=/home/chirag/Softwares/apache-tomcat-7.0.56 at the end of the file. So I remove that line ?
– ckpatel
May 17 '15 at 16:32




In my home directory I found .bashrc file and line export CATALINA_HOME=/home/chirag/Softwares/apache-tomcat-7.0.56 at the end of the file. So I remove that line ?
– ckpatel
May 17 '15 at 16:32












Thanks, I remove line containing CATALINA_HOME variable and it works.
– ckpatel
May 17 '15 at 16:48




Thanks, I remove line containing CATALINA_HOME variable and it works.
– ckpatel
May 17 '15 at 16:48












Glad to hear it! I've moved my comments into an answer so you can accept it as the valid answer and mark the question as 'solved'.
– Thomas Ward
May 17 '15 at 17:55




Glad to hear it! I've moved my comments into an answer so you can accept it as the valid answer and mark the question as 'solved'.
– Thomas Ward
May 17 '15 at 17:55










3 Answers
3






active

oldest

votes

















up vote
6
down vote



accepted










The environment variable is always going to be set if it's present in your configuration files for your system's environment variables or your own login profiles.



Open each of these files and search for a line that has export CATALINA_HOME, and remove the line where present:




  • /etc/environment

  • /etc/profile

  • ~/.profile

  • ~/.bashrc


Once removing the line from the file, log out, and log back in (if in a terminal, just close the terminal and reopen it). If it was in /etc/environment then consider rebooting the system first.



With the export line gone, the variable will be 'permanently unset' until the line is readded to one of those files.






share|improve this answer



















  • 1




    In my case I had to comment out export var in /etc/profile.
    – Rishabh Agrahari
    Jul 15 '17 at 3:46












  • JAVA_HOME is in none of these, yet set when I launch a terminal...
    – Xerus
    Apr 5 at 23:43










  • @Xerus Sounds like there might be something else called from one of these (check all the included filepaths inside each of these too) which sets JAVA_HOME. You might need your own question for this one, though.
    – Thomas Ward
    Apr 6 at 13:26


















up vote
0
down vote













Just to supplement the existing good answer, here's a simple line to help you to find the file you need to edit, based on this answer:



egrep -lir "export variable" /etc/environment /etc/profile ~/.profile ~/.bashrc



The word enclosed in quotes is the name of the environment variable it will search for.



It will provide you with the filename, then you just need to find the corresponding exprot line and comment or delete it.






share|improve this answer




























    up vote
    0
    down vote













    add unset CATALINA_HOME to the shell file (.bashrc or .zshrc)






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f624914%2fnot-able-to-unset-environmental-variable-permanently-ubuntu%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      6
      down vote



      accepted










      The environment variable is always going to be set if it's present in your configuration files for your system's environment variables or your own login profiles.



      Open each of these files and search for a line that has export CATALINA_HOME, and remove the line where present:




      • /etc/environment

      • /etc/profile

      • ~/.profile

      • ~/.bashrc


      Once removing the line from the file, log out, and log back in (if in a terminal, just close the terminal and reopen it). If it was in /etc/environment then consider rebooting the system first.



      With the export line gone, the variable will be 'permanently unset' until the line is readded to one of those files.






      share|improve this answer



















      • 1




        In my case I had to comment out export var in /etc/profile.
        – Rishabh Agrahari
        Jul 15 '17 at 3:46












      • JAVA_HOME is in none of these, yet set when I launch a terminal...
        – Xerus
        Apr 5 at 23:43










      • @Xerus Sounds like there might be something else called from one of these (check all the included filepaths inside each of these too) which sets JAVA_HOME. You might need your own question for this one, though.
        – Thomas Ward
        Apr 6 at 13:26















      up vote
      6
      down vote



      accepted










      The environment variable is always going to be set if it's present in your configuration files for your system's environment variables or your own login profiles.



      Open each of these files and search for a line that has export CATALINA_HOME, and remove the line where present:




      • /etc/environment

      • /etc/profile

      • ~/.profile

      • ~/.bashrc


      Once removing the line from the file, log out, and log back in (if in a terminal, just close the terminal and reopen it). If it was in /etc/environment then consider rebooting the system first.



      With the export line gone, the variable will be 'permanently unset' until the line is readded to one of those files.






      share|improve this answer



















      • 1




        In my case I had to comment out export var in /etc/profile.
        – Rishabh Agrahari
        Jul 15 '17 at 3:46












      • JAVA_HOME is in none of these, yet set when I launch a terminal...
        – Xerus
        Apr 5 at 23:43










      • @Xerus Sounds like there might be something else called from one of these (check all the included filepaths inside each of these too) which sets JAVA_HOME. You might need your own question for this one, though.
        – Thomas Ward
        Apr 6 at 13:26













      up vote
      6
      down vote



      accepted







      up vote
      6
      down vote



      accepted






      The environment variable is always going to be set if it's present in your configuration files for your system's environment variables or your own login profiles.



      Open each of these files and search for a line that has export CATALINA_HOME, and remove the line where present:




      • /etc/environment

      • /etc/profile

      • ~/.profile

      • ~/.bashrc


      Once removing the line from the file, log out, and log back in (if in a terminal, just close the terminal and reopen it). If it was in /etc/environment then consider rebooting the system first.



      With the export line gone, the variable will be 'permanently unset' until the line is readded to one of those files.






      share|improve this answer














      The environment variable is always going to be set if it's present in your configuration files for your system's environment variables or your own login profiles.



      Open each of these files and search for a line that has export CATALINA_HOME, and remove the line where present:




      • /etc/environment

      • /etc/profile

      • ~/.profile

      • ~/.bashrc


      Once removing the line from the file, log out, and log back in (if in a terminal, just close the terminal and reopen it). If it was in /etc/environment then consider rebooting the system first.



      With the export line gone, the variable will be 'permanently unset' until the line is readded to one of those files.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jan 30 at 19:37

























      answered May 17 '15 at 17:49









      Thomas Ward

      42.9k23119169




      42.9k23119169








      • 1




        In my case I had to comment out export var in /etc/profile.
        – Rishabh Agrahari
        Jul 15 '17 at 3:46












      • JAVA_HOME is in none of these, yet set when I launch a terminal...
        – Xerus
        Apr 5 at 23:43










      • @Xerus Sounds like there might be something else called from one of these (check all the included filepaths inside each of these too) which sets JAVA_HOME. You might need your own question for this one, though.
        – Thomas Ward
        Apr 6 at 13:26














      • 1




        In my case I had to comment out export var in /etc/profile.
        – Rishabh Agrahari
        Jul 15 '17 at 3:46












      • JAVA_HOME is in none of these, yet set when I launch a terminal...
        – Xerus
        Apr 5 at 23:43










      • @Xerus Sounds like there might be something else called from one of these (check all the included filepaths inside each of these too) which sets JAVA_HOME. You might need your own question for this one, though.
        – Thomas Ward
        Apr 6 at 13:26








      1




      1




      In my case I had to comment out export var in /etc/profile.
      – Rishabh Agrahari
      Jul 15 '17 at 3:46






      In my case I had to comment out export var in /etc/profile.
      – Rishabh Agrahari
      Jul 15 '17 at 3:46














      JAVA_HOME is in none of these, yet set when I launch a terminal...
      – Xerus
      Apr 5 at 23:43




      JAVA_HOME is in none of these, yet set when I launch a terminal...
      – Xerus
      Apr 5 at 23:43












      @Xerus Sounds like there might be something else called from one of these (check all the included filepaths inside each of these too) which sets JAVA_HOME. You might need your own question for this one, though.
      – Thomas Ward
      Apr 6 at 13:26




      @Xerus Sounds like there might be something else called from one of these (check all the included filepaths inside each of these too) which sets JAVA_HOME. You might need your own question for this one, though.
      – Thomas Ward
      Apr 6 at 13:26












      up vote
      0
      down vote













      Just to supplement the existing good answer, here's a simple line to help you to find the file you need to edit, based on this answer:



      egrep -lir "export variable" /etc/environment /etc/profile ~/.profile ~/.bashrc



      The word enclosed in quotes is the name of the environment variable it will search for.



      It will provide you with the filename, then you just need to find the corresponding exprot line and comment or delete it.






      share|improve this answer

























        up vote
        0
        down vote













        Just to supplement the existing good answer, here's a simple line to help you to find the file you need to edit, based on this answer:



        egrep -lir "export variable" /etc/environment /etc/profile ~/.profile ~/.bashrc



        The word enclosed in quotes is the name of the environment variable it will search for.



        It will provide you with the filename, then you just need to find the corresponding exprot line and comment or delete it.






        share|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          Just to supplement the existing good answer, here's a simple line to help you to find the file you need to edit, based on this answer:



          egrep -lir "export variable" /etc/environment /etc/profile ~/.profile ~/.bashrc



          The word enclosed in quotes is the name of the environment variable it will search for.



          It will provide you with the filename, then you just need to find the corresponding exprot line and comment or delete it.






          share|improve this answer












          Just to supplement the existing good answer, here's a simple line to help you to find the file you need to edit, based on this answer:



          egrep -lir "export variable" /etc/environment /etc/profile ~/.profile ~/.bashrc



          The word enclosed in quotes is the name of the environment variable it will search for.



          It will provide you with the filename, then you just need to find the corresponding exprot line and comment or delete it.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 5 at 23:43









          Xerus

          1034




          1034






















              up vote
              0
              down vote













              add unset CATALINA_HOME to the shell file (.bashrc or .zshrc)






              share|improve this answer



























                up vote
                0
                down vote













                add unset CATALINA_HOME to the shell file (.bashrc or .zshrc)






                share|improve this answer

























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  add unset CATALINA_HOME to the shell file (.bashrc or .zshrc)






                  share|improve this answer














                  add unset CATALINA_HOME to the shell file (.bashrc or .zshrc)







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 20 at 13:08









                  abu_bua

                  3,05281023




                  3,05281023










                  answered Nov 19 at 18:14









                  d27saurabh

                  1




                  1






























                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f624914%2fnot-able-to-unset-environmental-variable-permanently-ubuntu%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      How to send String Array data to Server using php in android

                      Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                      Is anime1.com a legal site for watching anime?