Lost PATH variable content












2















I was trying to add something to the PATH with :



export PATH=/user/home/sbt/bin


but I removed all of the content of PATH and I can not run any command on the terminal even ls ! So what should I do ? Can I fix it ?










share|improve this question























  • Have you tried with sudo PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games? This will only work for the actual session.

    – Lucio
    Mar 25 '13 at 18:54













  • Thank you @Lucio it helped me, but is there any way to undo to the old content ?

    – myildirim
    Mar 25 '13 at 18:56











  • Did the method of the answer below worked for you?

    – Lucio
    Mar 25 '13 at 19:09











  • Also, to know what paths do you have, enter cat /etc/environment in a terminal.

    – Lucio
    Mar 25 '13 at 20:29











  • @Lucio, after log out and log in the below worked for me

    – myildirim
    Mar 25 '13 at 22:45
















2















I was trying to add something to the PATH with :



export PATH=/user/home/sbt/bin


but I removed all of the content of PATH and I can not run any command on the terminal even ls ! So what should I do ? Can I fix it ?










share|improve this question























  • Have you tried with sudo PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games? This will only work for the actual session.

    – Lucio
    Mar 25 '13 at 18:54













  • Thank you @Lucio it helped me, but is there any way to undo to the old content ?

    – myildirim
    Mar 25 '13 at 18:56











  • Did the method of the answer below worked for you?

    – Lucio
    Mar 25 '13 at 19:09











  • Also, to know what paths do you have, enter cat /etc/environment in a terminal.

    – Lucio
    Mar 25 '13 at 20:29











  • @Lucio, after log out and log in the below worked for me

    – myildirim
    Mar 25 '13 at 22:45














2












2








2








I was trying to add something to the PATH with :



export PATH=/user/home/sbt/bin


but I removed all of the content of PATH and I can not run any command on the terminal even ls ! So what should I do ? Can I fix it ?










share|improve this question














I was trying to add something to the PATH with :



export PATH=/user/home/sbt/bin


but I removed all of the content of PATH and I can not run any command on the terminal even ls ! So what should I do ? Can I fix it ?







command-line environment-variables scripts






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 '13 at 18:42









myildirimmyildirim

161112




161112













  • Have you tried with sudo PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games? This will only work for the actual session.

    – Lucio
    Mar 25 '13 at 18:54













  • Thank you @Lucio it helped me, but is there any way to undo to the old content ?

    – myildirim
    Mar 25 '13 at 18:56











  • Did the method of the answer below worked for you?

    – Lucio
    Mar 25 '13 at 19:09











  • Also, to know what paths do you have, enter cat /etc/environment in a terminal.

    – Lucio
    Mar 25 '13 at 20:29











  • @Lucio, after log out and log in the below worked for me

    – myildirim
    Mar 25 '13 at 22:45



















  • Have you tried with sudo PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games? This will only work for the actual session.

    – Lucio
    Mar 25 '13 at 18:54













  • Thank you @Lucio it helped me, but is there any way to undo to the old content ?

    – myildirim
    Mar 25 '13 at 18:56











  • Did the method of the answer below worked for you?

    – Lucio
    Mar 25 '13 at 19:09











  • Also, to know what paths do you have, enter cat /etc/environment in a terminal.

    – Lucio
    Mar 25 '13 at 20:29











  • @Lucio, after log out and log in the below worked for me

    – myildirim
    Mar 25 '13 at 22:45

















Have you tried with sudo PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games? This will only work for the actual session.

– Lucio
Mar 25 '13 at 18:54







Have you tried with sudo PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games? This will only work for the actual session.

– Lucio
Mar 25 '13 at 18:54















Thank you @Lucio it helped me, but is there any way to undo to the old content ?

– myildirim
Mar 25 '13 at 18:56





Thank you @Lucio it helped me, but is there any way to undo to the old content ?

– myildirim
Mar 25 '13 at 18:56













Did the method of the answer below worked for you?

– Lucio
Mar 25 '13 at 19:09





Did the method of the answer below worked for you?

– Lucio
Mar 25 '13 at 19:09













Also, to know what paths do you have, enter cat /etc/environment in a terminal.

– Lucio
Mar 25 '13 at 20:29





Also, to know what paths do you have, enter cat /etc/environment in a terminal.

– Lucio
Mar 25 '13 at 20:29













@Lucio, after log out and log in the below worked for me

– myildirim
Mar 25 '13 at 22:45





@Lucio, after log out and log in the below worked for me

– myildirim
Mar 25 '13 at 22:45










2 Answers
2






active

oldest

votes


















3














Close the terminal app, and open a new one. The variable will be reset to its original state then.



If you're on a virtual terminal, and not running gnome-terminal or similar under X11, then you can log out and log back in again, to reset the variables. You can type exit to log out, or press Ctrl+D.






share|improve this answer































    0














    In case, the answer by dobey doesn't work for you.



    Follow these steps to recover the PATH environment variable :




    • Delete the culprit file from /etc/profile.d/ (if any)

    • Delete the culprit line from /etc/profile or ~/.bashrc (if any)

    • Execute source /etc/environment to start reseting the path environment variable

    • Execute source /etc/profile followed by source /etc/profile.d/*

    • At last source ~/.bashrc






    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',
      autoActivateHeartbeat: false,
      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%2f272372%2flost-path-variable-content%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3














      Close the terminal app, and open a new one. The variable will be reset to its original state then.



      If you're on a virtual terminal, and not running gnome-terminal or similar under X11, then you can log out and log back in again, to reset the variables. You can type exit to log out, or press Ctrl+D.






      share|improve this answer




























        3














        Close the terminal app, and open a new one. The variable will be reset to its original state then.



        If you're on a virtual terminal, and not running gnome-terminal or similar under X11, then you can log out and log back in again, to reset the variables. You can type exit to log out, or press Ctrl+D.






        share|improve this answer


























          3












          3








          3







          Close the terminal app, and open a new one. The variable will be reset to its original state then.



          If you're on a virtual terminal, and not running gnome-terminal or similar under X11, then you can log out and log back in again, to reset the variables. You can type exit to log out, or press Ctrl+D.






          share|improve this answer













          Close the terminal app, and open a new one. The variable will be reset to its original state then.



          If you're on a virtual terminal, and not running gnome-terminal or similar under X11, then you can log out and log back in again, to reset the variables. You can type exit to log out, or press Ctrl+D.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 '13 at 18:57









          dobeydobey

          33k33886




          33k33886

























              0














              In case, the answer by dobey doesn't work for you.



              Follow these steps to recover the PATH environment variable :




              • Delete the culprit file from /etc/profile.d/ (if any)

              • Delete the culprit line from /etc/profile or ~/.bashrc (if any)

              • Execute source /etc/environment to start reseting the path environment variable

              • Execute source /etc/profile followed by source /etc/profile.d/*

              • At last source ~/.bashrc






              share|improve this answer




























                0














                In case, the answer by dobey doesn't work for you.



                Follow these steps to recover the PATH environment variable :




                • Delete the culprit file from /etc/profile.d/ (if any)

                • Delete the culprit line from /etc/profile or ~/.bashrc (if any)

                • Execute source /etc/environment to start reseting the path environment variable

                • Execute source /etc/profile followed by source /etc/profile.d/*

                • At last source ~/.bashrc






                share|improve this answer


























                  0












                  0








                  0







                  In case, the answer by dobey doesn't work for you.



                  Follow these steps to recover the PATH environment variable :




                  • Delete the culprit file from /etc/profile.d/ (if any)

                  • Delete the culprit line from /etc/profile or ~/.bashrc (if any)

                  • Execute source /etc/environment to start reseting the path environment variable

                  • Execute source /etc/profile followed by source /etc/profile.d/*

                  • At last source ~/.bashrc






                  share|improve this answer













                  In case, the answer by dobey doesn't work for you.



                  Follow these steps to recover the PATH environment variable :




                  • Delete the culprit file from /etc/profile.d/ (if any)

                  • Delete the culprit line from /etc/profile or ~/.bashrc (if any)

                  • Execute source /etc/environment to start reseting the path environment variable

                  • Execute source /etc/profile followed by source /etc/profile.d/*

                  • At last source ~/.bashrc







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 28 at 9:32









                  Prashant Shahi - coolboi567Prashant Shahi - coolboi567

                  314




                  314






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f272372%2flost-path-variable-content%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

                      Mouse cursor on multiple screens with different PPI

                      Agildo Ribeiro

                      Sometime when accessing a menu: “Ubuntu 16.04 has experienced an internal error”