Fixing my PATH variable

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I am perplexed by the following problem and hoping someone can help me fix it:



when I type echo $PATH, I get the output:



/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games


However, I modified my PATH variable using gksudo gedit
/etc/environment
; the file now reads PATH="/opt/texbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games".



I am not sure why I am getting two different value of PATH. How can I fix it?



I am running Xfce on a Chromebook using Crouton if that helps.










share|improve this question























  • What command did you use to modify your PATH variable?
    – cremefraiche
    Apr 16 '15 at 21:38











  • @cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
    – DBS
    Apr 16 '15 at 21:40






  • 7




    That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in ~/.bashrc that says export PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example: export PATH=$PATH:...:/new/path
    – cremefraiche
    Apr 16 '15 at 21:44










  • @cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
    – DBS
    Apr 16 '15 at 21:46






  • 2




    From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that ~/.bashrc is run every time an interactive shell is opened, while ~/.bash_profile is run when a login shell is opened. Pick which file best suits your needs.
    – cremefraiche
    Apr 16 '15 at 21:54















up vote
2
down vote

favorite












I am perplexed by the following problem and hoping someone can help me fix it:



when I type echo $PATH, I get the output:



/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games


However, I modified my PATH variable using gksudo gedit
/etc/environment
; the file now reads PATH="/opt/texbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games".



I am not sure why I am getting two different value of PATH. How can I fix it?



I am running Xfce on a Chromebook using Crouton if that helps.










share|improve this question























  • What command did you use to modify your PATH variable?
    – cremefraiche
    Apr 16 '15 at 21:38











  • @cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
    – DBS
    Apr 16 '15 at 21:40






  • 7




    That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in ~/.bashrc that says export PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example: export PATH=$PATH:...:/new/path
    – cremefraiche
    Apr 16 '15 at 21:44










  • @cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
    – DBS
    Apr 16 '15 at 21:46






  • 2




    From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that ~/.bashrc is run every time an interactive shell is opened, while ~/.bash_profile is run when a login shell is opened. Pick which file best suits your needs.
    – cremefraiche
    Apr 16 '15 at 21:54













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I am perplexed by the following problem and hoping someone can help me fix it:



when I type echo $PATH, I get the output:



/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games


However, I modified my PATH variable using gksudo gedit
/etc/environment
; the file now reads PATH="/opt/texbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games".



I am not sure why I am getting two different value of PATH. How can I fix it?



I am running Xfce on a Chromebook using Crouton if that helps.










share|improve this question















I am perplexed by the following problem and hoping someone can help me fix it:



when I type echo $PATH, I get the output:



/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games


However, I modified my PATH variable using gksudo gedit
/etc/environment
; the file now reads PATH="/opt/texbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games".



I am not sure why I am getting two different value of PATH. How can I fix it?



I am running Xfce on a Chromebook using Crouton if that helps.







bash path






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 16 '15 at 21:53









dhag

10.8k32742




10.8k32742










asked Apr 16 '15 at 21:19









DBS

1277




1277











  • What command did you use to modify your PATH variable?
    – cremefraiche
    Apr 16 '15 at 21:38











  • @cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
    – DBS
    Apr 16 '15 at 21:40






  • 7




    That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in ~/.bashrc that says export PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example: export PATH=$PATH:...:/new/path
    – cremefraiche
    Apr 16 '15 at 21:44










  • @cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
    – DBS
    Apr 16 '15 at 21:46






  • 2




    From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that ~/.bashrc is run every time an interactive shell is opened, while ~/.bash_profile is run when a login shell is opened. Pick which file best suits your needs.
    – cremefraiche
    Apr 16 '15 at 21:54

















  • What command did you use to modify your PATH variable?
    – cremefraiche
    Apr 16 '15 at 21:38











  • @cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
    – DBS
    Apr 16 '15 at 21:40






  • 7




    That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in ~/.bashrc that says export PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example: export PATH=$PATH:...:/new/path
    – cremefraiche
    Apr 16 '15 at 21:44










  • @cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
    – DBS
    Apr 16 '15 at 21:46






  • 2




    From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that ~/.bashrc is run every time an interactive shell is opened, while ~/.bash_profile is run when a login shell is opened. Pick which file best suits your needs.
    – cremefraiche
    Apr 16 '15 at 21:54
















What command did you use to modify your PATH variable?
– cremefraiche
Apr 16 '15 at 21:38





What command did you use to modify your PATH variable?
– cremefraiche
Apr 16 '15 at 21:38













@cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
– DBS
Apr 16 '15 at 21:40




@cremefraiche I used <code> gksudo gedit /etc/environment </code> and then added <code> "/opt/texbin"</code> saved it rebooted but still the same problem.
– DBS
Apr 16 '15 at 21:40




7




7




That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in ~/.bashrc that says export PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example: export PATH=$PATH:...:/new/path
– cremefraiche
Apr 16 '15 at 21:44




That is not the way you should be changing your path variable. If you are trying to change the PATH variable for the current user only, modify the line in ~/.bashrc that says export PATH=$PATH:.... All you need to do is add a colon to the end and include the path. Example: export PATH=$PATH:...:/new/path
– cremefraiche
Apr 16 '15 at 21:44












@cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
– DBS
Apr 16 '15 at 21:46




@cremefraiche thanks let me try that. Btw would you explain why editing the PATh in /etc/environment doesnt work?
– DBS
Apr 16 '15 at 21:46




2




2




From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that ~/.bashrc is run every time an interactive shell is opened, while ~/.bash_profile is run when a login shell is opened. Pick which file best suits your needs.
– cremefraiche
Apr 16 '15 at 21:54





From what I understand it is best not to mess with that file directly, in order to minimize risk of breakage. I should mention that ~/.bashrc is run every time an interactive shell is opened, while ~/.bash_profile is run when a login shell is opened. Pick which file best suits your needs.
– cremefraiche
Apr 16 '15 at 21:54











2 Answers
2






active

oldest

votes

















up vote
1
down vote













The correct place to set your PATH is in ~/.bash_profile:



PATH="$PATH:/some/extra/paths:/may/go/here"


The PATH variable should already be exported, so you shouldn't need to export it again (exporting it again has no further effect).



The default path for bash is hardcoded into the bash executable, and then further (possibly) modified in /etc/profile and (on some systems) /etc/bash.bashrc.



My guess is that the path set in /etc/environment is primarily used by non-shells, such as cron etc.



See also:



  • How to permanently set environmental variables





share|improve this answer





























    up vote
    1
    down vote













    Edit




    • /etc/profile to affect all users.


    • ~/.bash_profile to affect single users bash shell (so not this one, as it is for bash specific stuff).


    • ~/.profile to affect single user, all shells.

    Note: If you have both .profile and .bash_profile and you want both to be read by bash, then you will have to add . .profile to your .bash_profile, as .profile is not read by default, if .bash_profile exists



    on sudo



    • don't run your editor as root, so don't do gksudo gedit «filename»

    • Avoid running X11 apps as root, so don't do gksudo gedit «filename»

    • instead do EDITOR=gedit sudoedit «filename». It will run the editor as you on a temporary file, it will copy the fill as root when you finish.





    share|improve this answer






















    • @Kusalananda I fixed answer.
      – ctrl-alt-delor
      Jun 23 at 11:32










    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    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: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f196702%2ffixing-my-path-variable%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    The correct place to set your PATH is in ~/.bash_profile:



    PATH="$PATH:/some/extra/paths:/may/go/here"


    The PATH variable should already be exported, so you shouldn't need to export it again (exporting it again has no further effect).



    The default path for bash is hardcoded into the bash executable, and then further (possibly) modified in /etc/profile and (on some systems) /etc/bash.bashrc.



    My guess is that the path set in /etc/environment is primarily used by non-shells, such as cron etc.



    See also:



    • How to permanently set environmental variables





    share|improve this answer


























      up vote
      1
      down vote













      The correct place to set your PATH is in ~/.bash_profile:



      PATH="$PATH:/some/extra/paths:/may/go/here"


      The PATH variable should already be exported, so you shouldn't need to export it again (exporting it again has no further effect).



      The default path for bash is hardcoded into the bash executable, and then further (possibly) modified in /etc/profile and (on some systems) /etc/bash.bashrc.



      My guess is that the path set in /etc/environment is primarily used by non-shells, such as cron etc.



      See also:



      • How to permanently set environmental variables





      share|improve this answer
























        up vote
        1
        down vote










        up vote
        1
        down vote









        The correct place to set your PATH is in ~/.bash_profile:



        PATH="$PATH:/some/extra/paths:/may/go/here"


        The PATH variable should already be exported, so you shouldn't need to export it again (exporting it again has no further effect).



        The default path for bash is hardcoded into the bash executable, and then further (possibly) modified in /etc/profile and (on some systems) /etc/bash.bashrc.



        My guess is that the path set in /etc/environment is primarily used by non-shells, such as cron etc.



        See also:



        • How to permanently set environmental variables





        share|improve this answer














        The correct place to set your PATH is in ~/.bash_profile:



        PATH="$PATH:/some/extra/paths:/may/go/here"


        The PATH variable should already be exported, so you shouldn't need to export it again (exporting it again has no further effect).



        The default path for bash is hardcoded into the bash executable, and then further (possibly) modified in /etc/profile and (on some systems) /etc/bash.bashrc.



        My guess is that the path set in /etc/environment is primarily used by non-shells, such as cron etc.



        See also:



        • How to permanently set environmental variables






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jun 23 at 9:53

























        answered May 23 '17 at 22:08









        Kusalananda

        107k14209329




        107k14209329






















            up vote
            1
            down vote













            Edit




            • /etc/profile to affect all users.


            • ~/.bash_profile to affect single users bash shell (so not this one, as it is for bash specific stuff).


            • ~/.profile to affect single user, all shells.

            Note: If you have both .profile and .bash_profile and you want both to be read by bash, then you will have to add . .profile to your .bash_profile, as .profile is not read by default, if .bash_profile exists



            on sudo



            • don't run your editor as root, so don't do gksudo gedit «filename»

            • Avoid running X11 apps as root, so don't do gksudo gedit «filename»

            • instead do EDITOR=gedit sudoedit «filename». It will run the editor as you on a temporary file, it will copy the fill as root when you finish.





            share|improve this answer






















            • @Kusalananda I fixed answer.
              – ctrl-alt-delor
              Jun 23 at 11:32














            up vote
            1
            down vote













            Edit




            • /etc/profile to affect all users.


            • ~/.bash_profile to affect single users bash shell (so not this one, as it is for bash specific stuff).


            • ~/.profile to affect single user, all shells.

            Note: If you have both .profile and .bash_profile and you want both to be read by bash, then you will have to add . .profile to your .bash_profile, as .profile is not read by default, if .bash_profile exists



            on sudo



            • don't run your editor as root, so don't do gksudo gedit «filename»

            • Avoid running X11 apps as root, so don't do gksudo gedit «filename»

            • instead do EDITOR=gedit sudoedit «filename». It will run the editor as you on a temporary file, it will copy the fill as root when you finish.





            share|improve this answer






















            • @Kusalananda I fixed answer.
              – ctrl-alt-delor
              Jun 23 at 11:32












            up vote
            1
            down vote










            up vote
            1
            down vote









            Edit




            • /etc/profile to affect all users.


            • ~/.bash_profile to affect single users bash shell (so not this one, as it is for bash specific stuff).


            • ~/.profile to affect single user, all shells.

            Note: If you have both .profile and .bash_profile and you want both to be read by bash, then you will have to add . .profile to your .bash_profile, as .profile is not read by default, if .bash_profile exists



            on sudo



            • don't run your editor as root, so don't do gksudo gedit «filename»

            • Avoid running X11 apps as root, so don't do gksudo gedit «filename»

            • instead do EDITOR=gedit sudoedit «filename». It will run the editor as you on a temporary file, it will copy the fill as root when you finish.





            share|improve this answer














            Edit




            • /etc/profile to affect all users.


            • ~/.bash_profile to affect single users bash shell (so not this one, as it is for bash specific stuff).


            • ~/.profile to affect single user, all shells.

            Note: If you have both .profile and .bash_profile and you want both to be read by bash, then you will have to add . .profile to your .bash_profile, as .profile is not read by default, if .bash_profile exists



            on sudo



            • don't run your editor as root, so don't do gksudo gedit «filename»

            • Avoid running X11 apps as root, so don't do gksudo gedit «filename»

            • instead do EDITOR=gedit sudoedit «filename». It will run the editor as you on a temporary file, it will copy the fill as root when you finish.






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jun 23 at 11:32

























            answered Jun 23 at 10:36









            ctrl-alt-delor

            9,20431948




            9,20431948











            • @Kusalananda I fixed answer.
              – ctrl-alt-delor
              Jun 23 at 11:32
















            • @Kusalananda I fixed answer.
              – ctrl-alt-delor
              Jun 23 at 11:32















            @Kusalananda I fixed answer.
            – ctrl-alt-delor
            Jun 23 at 11:32




            @Kusalananda I fixed answer.
            – ctrl-alt-delor
            Jun 23 at 11:32

















             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f196702%2ffixing-my-path-variable%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Peggy Mitchell

            Palaiologos

            The Forum (Inglewood, California)