Why $PATH is not reflecting what is in the environment file, Ubuntu 18.04?











up vote
3
down vote

favorite












echo $PATH provides:



/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin


while /etc/environment states



PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"


I though the environment file is responsible for setting the PATH environment. I mean the file is called environment, and the only commend therein is path. What am I missing?



This is Ubuntu 18.04.1 and when I try to run pcsxr, it tells me /usr/games is not added to environment variable. This seems true from one point of view and false from another point of view. There is no problem with the desktop file, it has been validated. Also that game in question has been validated to be at /usr/games



Running this command:



$ grep --color -H 'PATH=' ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login 
~/.bash_aliases /etc/bash.bashrc /etc/profile
/etc/profile.d/* /etc/environment 2> /dev/null

/home/neonred811/.profile: PATH="$HOME/bin:$PATH"
/home/neonred811/.profile: PATH="$HOME/.local/bin:$PATH"
/etc/environment:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"









share|improve this question




















  • 4




    It's probably getting overwritten elsewhere. Try askubuntu.com/a/706069/158442
    – muru
    Aug 19 at 8:25










  • I tried that and nothing matches, the echo $PATH, and closest match is environment, I thought to myself cursing, ok whereis $PATH, strangely this pointed to /usr/local/bin, and when I went the only file therein was browsh which is a new text browser mario style using firefox backend
    – Uranium
    Aug 19 at 8:42






  • 2




    whereis $PATH makes no sense, so the rest of that is irrelevant. Also, show us the output you got from running the grep in the linked post. Also, how did you install Ubuntu? Is this a VPS or a VM or similar?
    – muru
    Aug 19 at 8:47












  • This is a virtual machine in virtual box. I installed from Ubuntu Basic Server ground up, making my own respin, and this annoying problem
    – Uranium
    Aug 19 at 9:01






  • 2




    Well, there's two possibilities: one as muru said, PATH is being overwritten, which is more likely, and another - /etc/environment not being sourced. Since any of config files may source other files, it's isn't guaranteed where exactly that variable is overwritten. I'd say, just add that directory into your PATH via ~/.bashrc and forget the trouble. But of course if you wanna find what actually happened, grep through everything for files being sourced, and then grep through those
    – Sergiy Kolodyazhnyy
    Aug 19 at 9:12















up vote
3
down vote

favorite












echo $PATH provides:



/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin


while /etc/environment states



PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"


I though the environment file is responsible for setting the PATH environment. I mean the file is called environment, and the only commend therein is path. What am I missing?



This is Ubuntu 18.04.1 and when I try to run pcsxr, it tells me /usr/games is not added to environment variable. This seems true from one point of view and false from another point of view. There is no problem with the desktop file, it has been validated. Also that game in question has been validated to be at /usr/games



Running this command:



$ grep --color -H 'PATH=' ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login 
~/.bash_aliases /etc/bash.bashrc /etc/profile
/etc/profile.d/* /etc/environment 2> /dev/null

/home/neonred811/.profile: PATH="$HOME/bin:$PATH"
/home/neonred811/.profile: PATH="$HOME/.local/bin:$PATH"
/etc/environment:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"









share|improve this question




















  • 4




    It's probably getting overwritten elsewhere. Try askubuntu.com/a/706069/158442
    – muru
    Aug 19 at 8:25










  • I tried that and nothing matches, the echo $PATH, and closest match is environment, I thought to myself cursing, ok whereis $PATH, strangely this pointed to /usr/local/bin, and when I went the only file therein was browsh which is a new text browser mario style using firefox backend
    – Uranium
    Aug 19 at 8:42






  • 2




    whereis $PATH makes no sense, so the rest of that is irrelevant. Also, show us the output you got from running the grep in the linked post. Also, how did you install Ubuntu? Is this a VPS or a VM or similar?
    – muru
    Aug 19 at 8:47












  • This is a virtual machine in virtual box. I installed from Ubuntu Basic Server ground up, making my own respin, and this annoying problem
    – Uranium
    Aug 19 at 9:01






  • 2




    Well, there's two possibilities: one as muru said, PATH is being overwritten, which is more likely, and another - /etc/environment not being sourced. Since any of config files may source other files, it's isn't guaranteed where exactly that variable is overwritten. I'd say, just add that directory into your PATH via ~/.bashrc and forget the trouble. But of course if you wanna find what actually happened, grep through everything for files being sourced, and then grep through those
    – Sergiy Kolodyazhnyy
    Aug 19 at 9:12













up vote
3
down vote

favorite









up vote
3
down vote

favorite











echo $PATH provides:



/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin


while /etc/environment states



PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"


I though the environment file is responsible for setting the PATH environment. I mean the file is called environment, and the only commend therein is path. What am I missing?



This is Ubuntu 18.04.1 and when I try to run pcsxr, it tells me /usr/games is not added to environment variable. This seems true from one point of view and false from another point of view. There is no problem with the desktop file, it has been validated. Also that game in question has been validated to be at /usr/games



Running this command:



$ grep --color -H 'PATH=' ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login 
~/.bash_aliases /etc/bash.bashrc /etc/profile
/etc/profile.d/* /etc/environment 2> /dev/null

/home/neonred811/.profile: PATH="$HOME/bin:$PATH"
/home/neonred811/.profile: PATH="$HOME/.local/bin:$PATH"
/etc/environment:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"









share|improve this question















echo $PATH provides:



/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin


while /etc/environment states



PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"


I though the environment file is responsible for setting the PATH environment. I mean the file is called environment, and the only commend therein is path. What am I missing?



This is Ubuntu 18.04.1 and when I try to run pcsxr, it tells me /usr/games is not added to environment variable. This seems true from one point of view and false from another point of view. There is no problem with the desktop file, it has been validated. Also that game in question has been validated to be at /usr/games



Running this command:



$ grep --color -H 'PATH=' ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login 
~/.bash_aliases /etc/bash.bashrc /etc/profile
/etc/profile.d/* /etc/environment 2> /dev/null

/home/neonred811/.profile: PATH="$HOME/bin:$PATH"
/home/neonred811/.profile: PATH="$HOME/.local/bin:$PATH"
/etc/environment:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"






environment






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 19 at 12:59









abu_bua

2,93471021




2,93471021










asked Aug 19 at 8:22









Uranium

162




162








  • 4




    It's probably getting overwritten elsewhere. Try askubuntu.com/a/706069/158442
    – muru
    Aug 19 at 8:25










  • I tried that and nothing matches, the echo $PATH, and closest match is environment, I thought to myself cursing, ok whereis $PATH, strangely this pointed to /usr/local/bin, and when I went the only file therein was browsh which is a new text browser mario style using firefox backend
    – Uranium
    Aug 19 at 8:42






  • 2




    whereis $PATH makes no sense, so the rest of that is irrelevant. Also, show us the output you got from running the grep in the linked post. Also, how did you install Ubuntu? Is this a VPS or a VM or similar?
    – muru
    Aug 19 at 8:47












  • This is a virtual machine in virtual box. I installed from Ubuntu Basic Server ground up, making my own respin, and this annoying problem
    – Uranium
    Aug 19 at 9:01






  • 2




    Well, there's two possibilities: one as muru said, PATH is being overwritten, which is more likely, and another - /etc/environment not being sourced. Since any of config files may source other files, it's isn't guaranteed where exactly that variable is overwritten. I'd say, just add that directory into your PATH via ~/.bashrc and forget the trouble. But of course if you wanna find what actually happened, grep through everything for files being sourced, and then grep through those
    – Sergiy Kolodyazhnyy
    Aug 19 at 9:12














  • 4




    It's probably getting overwritten elsewhere. Try askubuntu.com/a/706069/158442
    – muru
    Aug 19 at 8:25










  • I tried that and nothing matches, the echo $PATH, and closest match is environment, I thought to myself cursing, ok whereis $PATH, strangely this pointed to /usr/local/bin, and when I went the only file therein was browsh which is a new text browser mario style using firefox backend
    – Uranium
    Aug 19 at 8:42






  • 2




    whereis $PATH makes no sense, so the rest of that is irrelevant. Also, show us the output you got from running the grep in the linked post. Also, how did you install Ubuntu? Is this a VPS or a VM or similar?
    – muru
    Aug 19 at 8:47












  • This is a virtual machine in virtual box. I installed from Ubuntu Basic Server ground up, making my own respin, and this annoying problem
    – Uranium
    Aug 19 at 9:01






  • 2




    Well, there's two possibilities: one as muru said, PATH is being overwritten, which is more likely, and another - /etc/environment not being sourced. Since any of config files may source other files, it's isn't guaranteed where exactly that variable is overwritten. I'd say, just add that directory into your PATH via ~/.bashrc and forget the trouble. But of course if you wanna find what actually happened, grep through everything for files being sourced, and then grep through those
    – Sergiy Kolodyazhnyy
    Aug 19 at 9:12








4




4




It's probably getting overwritten elsewhere. Try askubuntu.com/a/706069/158442
– muru
Aug 19 at 8:25




It's probably getting overwritten elsewhere. Try askubuntu.com/a/706069/158442
– muru
Aug 19 at 8:25












I tried that and nothing matches, the echo $PATH, and closest match is environment, I thought to myself cursing, ok whereis $PATH, strangely this pointed to /usr/local/bin, and when I went the only file therein was browsh which is a new text browser mario style using firefox backend
– Uranium
Aug 19 at 8:42




I tried that and nothing matches, the echo $PATH, and closest match is environment, I thought to myself cursing, ok whereis $PATH, strangely this pointed to /usr/local/bin, and when I went the only file therein was browsh which is a new text browser mario style using firefox backend
– Uranium
Aug 19 at 8:42




2




2




whereis $PATH makes no sense, so the rest of that is irrelevant. Also, show us the output you got from running the grep in the linked post. Also, how did you install Ubuntu? Is this a VPS or a VM or similar?
– muru
Aug 19 at 8:47






whereis $PATH makes no sense, so the rest of that is irrelevant. Also, show us the output you got from running the grep in the linked post. Also, how did you install Ubuntu? Is this a VPS or a VM or similar?
– muru
Aug 19 at 8:47














This is a virtual machine in virtual box. I installed from Ubuntu Basic Server ground up, making my own respin, and this annoying problem
– Uranium
Aug 19 at 9:01




This is a virtual machine in virtual box. I installed from Ubuntu Basic Server ground up, making my own respin, and this annoying problem
– Uranium
Aug 19 at 9:01




2




2




Well, there's two possibilities: one as muru said, PATH is being overwritten, which is more likely, and another - /etc/environment not being sourced. Since any of config files may source other files, it's isn't guaranteed where exactly that variable is overwritten. I'd say, just add that directory into your PATH via ~/.bashrc and forget the trouble. But of course if you wanna find what actually happened, grep through everything for files being sourced, and then grep through those
– Sergiy Kolodyazhnyy
Aug 19 at 9:12




Well, there's two possibilities: one as muru said, PATH is being overwritten, which is more likely, and another - /etc/environment not being sourced. Since any of config files may source other files, it's isn't guaranteed where exactly that variable is overwritten. I'd say, just add that directory into your PATH via ~/.bashrc and forget the trouble. But of course if you wanna find what actually happened, grep through everything for files being sourced, and then grep through those
– Sergiy Kolodyazhnyy
Aug 19 at 9:12










2 Answers
2






active

oldest

votes

















up vote
0
down vote













I had the same problem while trying to set my JAVA_HOME environment variable (link) after installing the default-jdk apt package, also on Ubuntu 18.04.1.



Setting JAVA_HOME in /etc/environment didn't work at all, even though that file is symlinked in /usr/lib/environment.d/ as described here.



Setting it in ~/.profile did work, but was obviously not system-wide, so some tools couldn't see it and it was just a pain.



I ended up setting it using a script in /etc/profile.d/ as described here, and that finally worked.



I have no idea why /etc/environment isn't working. I've successfully used that method on Ubuntu 16.04, but no luck on 18.04. I also grepped everything in /etc/ as described in this related question and also suggested here, but couldn't get to the bottom of it.






share|improve this answer








New contributor




bszom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    up vote
    0
    down vote













    You can grep everything to find out where /usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin is being set:



    time sudo grep -rnw 
    --exclude-dir={boot,dev,lib,media,mnt,proc,root,run,sys,/tmp,tmpfs,var} '/' -e
    "/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin"


    This will take a few minutes to run so make some coffee or take out the garbage. On an NVMe SSD though it will take 45 seconds and show this:



    Binary file /home/rick/.mozilla/firefox/9fu0cuql.default/places.sqlite matches
    Binary file /home/rick/.mozilla/firefox/9fu0cuql.default/places.sqlite-wal matches

    real 0m46.343s
    user 0m13.143s
    sys 0m8.853s


    On my system the only place where the path is overridden like yours is by Firefox.



    However my $PATH variable is always normal (for me):



    $ echo $PATH
    /home/rick/bin:/home/rick/.local/bin:/mnt/e/bin:/mnt/e/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin





    share|improve this answer



















    • 1




      Just in case that fails, you could try changing the search term to PATH and/or taking /media and /mnt out of the list. Also it might be quicker to try searching just in /etc and $HOME first, then try searching from the root directory if needed.
      – wjandrea
      Nov 12 at 15:07












    • @wjandrea Thank you for your insightful comment. I just revised the answer but your comment is still relevant for others.
      – WinEunuuchs2Unix
      Nov 12 at 19:17











    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%2f1066780%2fwhy-path-is-not-reflecting-what-is-in-the-environment-file-ubuntu-18-04%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








    up vote
    0
    down vote













    I had the same problem while trying to set my JAVA_HOME environment variable (link) after installing the default-jdk apt package, also on Ubuntu 18.04.1.



    Setting JAVA_HOME in /etc/environment didn't work at all, even though that file is symlinked in /usr/lib/environment.d/ as described here.



    Setting it in ~/.profile did work, but was obviously not system-wide, so some tools couldn't see it and it was just a pain.



    I ended up setting it using a script in /etc/profile.d/ as described here, and that finally worked.



    I have no idea why /etc/environment isn't working. I've successfully used that method on Ubuntu 16.04, but no luck on 18.04. I also grepped everything in /etc/ as described in this related question and also suggested here, but couldn't get to the bottom of it.






    share|improve this answer








    New contributor




    bszom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote













      I had the same problem while trying to set my JAVA_HOME environment variable (link) after installing the default-jdk apt package, also on Ubuntu 18.04.1.



      Setting JAVA_HOME in /etc/environment didn't work at all, even though that file is symlinked in /usr/lib/environment.d/ as described here.



      Setting it in ~/.profile did work, but was obviously not system-wide, so some tools couldn't see it and it was just a pain.



      I ended up setting it using a script in /etc/profile.d/ as described here, and that finally worked.



      I have no idea why /etc/environment isn't working. I've successfully used that method on Ubuntu 16.04, but no luck on 18.04. I also grepped everything in /etc/ as described in this related question and also suggested here, but couldn't get to the bottom of it.






      share|improve this answer








      New contributor




      bszom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        up vote
        0
        down vote










        up vote
        0
        down vote









        I had the same problem while trying to set my JAVA_HOME environment variable (link) after installing the default-jdk apt package, also on Ubuntu 18.04.1.



        Setting JAVA_HOME in /etc/environment didn't work at all, even though that file is symlinked in /usr/lib/environment.d/ as described here.



        Setting it in ~/.profile did work, but was obviously not system-wide, so some tools couldn't see it and it was just a pain.



        I ended up setting it using a script in /etc/profile.d/ as described here, and that finally worked.



        I have no idea why /etc/environment isn't working. I've successfully used that method on Ubuntu 16.04, but no luck on 18.04. I also grepped everything in /etc/ as described in this related question and also suggested here, but couldn't get to the bottom of it.






        share|improve this answer








        New contributor




        bszom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        I had the same problem while trying to set my JAVA_HOME environment variable (link) after installing the default-jdk apt package, also on Ubuntu 18.04.1.



        Setting JAVA_HOME in /etc/environment didn't work at all, even though that file is symlinked in /usr/lib/environment.d/ as described here.



        Setting it in ~/.profile did work, but was obviously not system-wide, so some tools couldn't see it and it was just a pain.



        I ended up setting it using a script in /etc/profile.d/ as described here, and that finally worked.



        I have no idea why /etc/environment isn't working. I've successfully used that method on Ubuntu 16.04, but no luck on 18.04. I also grepped everything in /etc/ as described in this related question and also suggested here, but couldn't get to the bottom of it.







        share|improve this answer








        New contributor




        bszom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        bszom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered Nov 12 at 12:06









        bszom

        1011




        1011




        New contributor




        bszom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        bszom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        bszom is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.
























            up vote
            0
            down vote













            You can grep everything to find out where /usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin is being set:



            time sudo grep -rnw 
            --exclude-dir={boot,dev,lib,media,mnt,proc,root,run,sys,/tmp,tmpfs,var} '/' -e
            "/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin"


            This will take a few minutes to run so make some coffee or take out the garbage. On an NVMe SSD though it will take 45 seconds and show this:



            Binary file /home/rick/.mozilla/firefox/9fu0cuql.default/places.sqlite matches
            Binary file /home/rick/.mozilla/firefox/9fu0cuql.default/places.sqlite-wal matches

            real 0m46.343s
            user 0m13.143s
            sys 0m8.853s


            On my system the only place where the path is overridden like yours is by Firefox.



            However my $PATH variable is always normal (for me):



            $ echo $PATH
            /home/rick/bin:/home/rick/.local/bin:/mnt/e/bin:/mnt/e/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin





            share|improve this answer



















            • 1




              Just in case that fails, you could try changing the search term to PATH and/or taking /media and /mnt out of the list. Also it might be quicker to try searching just in /etc and $HOME first, then try searching from the root directory if needed.
              – wjandrea
              Nov 12 at 15:07












            • @wjandrea Thank you for your insightful comment. I just revised the answer but your comment is still relevant for others.
              – WinEunuuchs2Unix
              Nov 12 at 19:17















            up vote
            0
            down vote













            You can grep everything to find out where /usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin is being set:



            time sudo grep -rnw 
            --exclude-dir={boot,dev,lib,media,mnt,proc,root,run,sys,/tmp,tmpfs,var} '/' -e
            "/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin"


            This will take a few minutes to run so make some coffee or take out the garbage. On an NVMe SSD though it will take 45 seconds and show this:



            Binary file /home/rick/.mozilla/firefox/9fu0cuql.default/places.sqlite matches
            Binary file /home/rick/.mozilla/firefox/9fu0cuql.default/places.sqlite-wal matches

            real 0m46.343s
            user 0m13.143s
            sys 0m8.853s


            On my system the only place where the path is overridden like yours is by Firefox.



            However my $PATH variable is always normal (for me):



            $ echo $PATH
            /home/rick/bin:/home/rick/.local/bin:/mnt/e/bin:/mnt/e/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin





            share|improve this answer



















            • 1




              Just in case that fails, you could try changing the search term to PATH and/or taking /media and /mnt out of the list. Also it might be quicker to try searching just in /etc and $HOME first, then try searching from the root directory if needed.
              – wjandrea
              Nov 12 at 15:07












            • @wjandrea Thank you for your insightful comment. I just revised the answer but your comment is still relevant for others.
              – WinEunuuchs2Unix
              Nov 12 at 19:17













            up vote
            0
            down vote










            up vote
            0
            down vote









            You can grep everything to find out where /usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin is being set:



            time sudo grep -rnw 
            --exclude-dir={boot,dev,lib,media,mnt,proc,root,run,sys,/tmp,tmpfs,var} '/' -e
            "/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin"


            This will take a few minutes to run so make some coffee or take out the garbage. On an NVMe SSD though it will take 45 seconds and show this:



            Binary file /home/rick/.mozilla/firefox/9fu0cuql.default/places.sqlite matches
            Binary file /home/rick/.mozilla/firefox/9fu0cuql.default/places.sqlite-wal matches

            real 0m46.343s
            user 0m13.143s
            sys 0m8.853s


            On my system the only place where the path is overridden like yours is by Firefox.



            However my $PATH variable is always normal (for me):



            $ echo $PATH
            /home/rick/bin:/home/rick/.local/bin:/mnt/e/bin:/mnt/e/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin





            share|improve this answer














            You can grep everything to find out where /usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin is being set:



            time sudo grep -rnw 
            --exclude-dir={boot,dev,lib,media,mnt,proc,root,run,sys,/tmp,tmpfs,var} '/' -e
            "/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin"


            This will take a few minutes to run so make some coffee or take out the garbage. On an NVMe SSD though it will take 45 seconds and show this:



            Binary file /home/rick/.mozilla/firefox/9fu0cuql.default/places.sqlite matches
            Binary file /home/rick/.mozilla/firefox/9fu0cuql.default/places.sqlite-wal matches

            real 0m46.343s
            user 0m13.143s
            sys 0m8.853s


            On my system the only place where the path is overridden like yours is by Firefox.



            However my $PATH variable is always normal (for me):



            $ echo $PATH
            /home/rick/bin:/home/rick/.local/bin:/mnt/e/bin:/mnt/e/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 12 at 19:16

























            answered Aug 19 at 20:07









            WinEunuuchs2Unix

            39.1k1062144




            39.1k1062144








            • 1




              Just in case that fails, you could try changing the search term to PATH and/or taking /media and /mnt out of the list. Also it might be quicker to try searching just in /etc and $HOME first, then try searching from the root directory if needed.
              – wjandrea
              Nov 12 at 15:07












            • @wjandrea Thank you for your insightful comment. I just revised the answer but your comment is still relevant for others.
              – WinEunuuchs2Unix
              Nov 12 at 19:17














            • 1




              Just in case that fails, you could try changing the search term to PATH and/or taking /media and /mnt out of the list. Also it might be quicker to try searching just in /etc and $HOME first, then try searching from the root directory if needed.
              – wjandrea
              Nov 12 at 15:07












            • @wjandrea Thank you for your insightful comment. I just revised the answer but your comment is still relevant for others.
              – WinEunuuchs2Unix
              Nov 12 at 19:17








            1




            1




            Just in case that fails, you could try changing the search term to PATH and/or taking /media and /mnt out of the list. Also it might be quicker to try searching just in /etc and $HOME first, then try searching from the root directory if needed.
            – wjandrea
            Nov 12 at 15:07






            Just in case that fails, you could try changing the search term to PATH and/or taking /media and /mnt out of the list. Also it might be quicker to try searching just in /etc and $HOME first, then try searching from the root directory if needed.
            – wjandrea
            Nov 12 at 15:07














            @wjandrea Thank you for your insightful comment. I just revised the answer but your comment is still relevant for others.
            – WinEunuuchs2Unix
            Nov 12 at 19:17




            @wjandrea Thank you for your insightful comment. I just revised the answer but your comment is still relevant for others.
            – WinEunuuchs2Unix
            Nov 12 at 19:17


















             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1066780%2fwhy-path-is-not-reflecting-what-is-in-the-environment-file-ubuntu-18-04%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 change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents