Installed program executable runs from wrong location

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











up vote
3
down vote

favorite












I installed parcellite in Ubuntu (downloaded from http://parcellite.sourceforge.net/)



After installing from sources, sudo make install, I can see that it is installed at below location.



However, when I try to run it, it tries to run it from another path. Why is that?



user$ which parcellite
/usr/local/bin/parcellite

user$ parcellite -h
bash: /usr/bin/parcellite: No such file or directory


$PATH is as below



/home/user/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games



I tried changing ownership of executable as follows. Still the problem persists.



user$ ls -l /usr/local/bin/parcellite 
-rwxr-xr-x 1 root root 452K Oct 7 21:00 /usr/local/bin/parcellite
user$sudo chown user:user /usr/local/bin/parcellite
user$ ls -l /usr/local/bin/parcellite
-rwxr-xr-x 1 user user 452K Oct 7 21:01 /usr/local/bin/parcellite


I had an older version of parcellite installed. But I removed it prior to installing new version.




Update: @Fox's solution works. But any idea why which command gives correct path, despite hashNOT being updated?










share|improve this question



























    up vote
    3
    down vote

    favorite












    I installed parcellite in Ubuntu (downloaded from http://parcellite.sourceforge.net/)



    After installing from sources, sudo make install, I can see that it is installed at below location.



    However, when I try to run it, it tries to run it from another path. Why is that?



    user$ which parcellite
    /usr/local/bin/parcellite

    user$ parcellite -h
    bash: /usr/bin/parcellite: No such file or directory


    $PATH is as below



    /home/user/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games



    I tried changing ownership of executable as follows. Still the problem persists.



    user$ ls -l /usr/local/bin/parcellite 
    -rwxr-xr-x 1 root root 452K Oct 7 21:00 /usr/local/bin/parcellite
    user$sudo chown user:user /usr/local/bin/parcellite
    user$ ls -l /usr/local/bin/parcellite
    -rwxr-xr-x 1 user user 452K Oct 7 21:01 /usr/local/bin/parcellite


    I had an older version of parcellite installed. But I removed it prior to installing new version.




    Update: @Fox's solution works. But any idea why which command gives correct path, despite hashNOT being updated?










    share|improve this question

























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I installed parcellite in Ubuntu (downloaded from http://parcellite.sourceforge.net/)



      After installing from sources, sudo make install, I can see that it is installed at below location.



      However, when I try to run it, it tries to run it from another path. Why is that?



      user$ which parcellite
      /usr/local/bin/parcellite

      user$ parcellite -h
      bash: /usr/bin/parcellite: No such file or directory


      $PATH is as below



      /home/user/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games



      I tried changing ownership of executable as follows. Still the problem persists.



      user$ ls -l /usr/local/bin/parcellite 
      -rwxr-xr-x 1 root root 452K Oct 7 21:00 /usr/local/bin/parcellite
      user$sudo chown user:user /usr/local/bin/parcellite
      user$ ls -l /usr/local/bin/parcellite
      -rwxr-xr-x 1 user user 452K Oct 7 21:01 /usr/local/bin/parcellite


      I had an older version of parcellite installed. But I removed it prior to installing new version.




      Update: @Fox's solution works. But any idea why which command gives correct path, despite hashNOT being updated?










      share|improve this question















      I installed parcellite in Ubuntu (downloaded from http://parcellite.sourceforge.net/)



      After installing from sources, sudo make install, I can see that it is installed at below location.



      However, when I try to run it, it tries to run it from another path. Why is that?



      user$ which parcellite
      /usr/local/bin/parcellite

      user$ parcellite -h
      bash: /usr/bin/parcellite: No such file or directory


      $PATH is as below



      /home/user/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games



      I tried changing ownership of executable as follows. Still the problem persists.



      user$ ls -l /usr/local/bin/parcellite 
      -rwxr-xr-x 1 root root 452K Oct 7 21:00 /usr/local/bin/parcellite
      user$sudo chown user:user /usr/local/bin/parcellite
      user$ ls -l /usr/local/bin/parcellite
      -rwxr-xr-x 1 user user 452K Oct 7 21:01 /usr/local/bin/parcellite


      I had an older version of parcellite installed. But I removed it prior to installing new version.




      Update: @Fox's solution works. But any idea why which command gives correct path, despite hashNOT being updated?







      bash ubuntu path gnome-shell parcellite






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 1 hour ago

























      asked 1 hour ago









      Roger That

      535




      535




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          If you had a version installed, then installed another version elsewhere, then your shell will have cached (hashed) the original path. You can clear this cache with hash -r. Then the next time you run the command it will be rehashed with the new path.



          Note that this cache is not global, if you have several running shells you will have to update each of them.



          As to why which sees the correct path, "Why not use which" is a good source of information, but the short answer is that which is an external command that doesn't see the shell's path cache.






          share|improve this answer






















          • Thanks! This worked! I had earlier tried sudo updatedb but that didn't work. I think that hash commands needs to run automatically each time a program is installed.
            – Roger That
            1 hour ago







          • 1




            More info about hash was found here. unix.stackexchange.com/questions/86012/… hash is a bash built-in command. The hash table is a feature of bash that prevents it from having to search $PATH every time you type a command by caching the results in memory. The table gets cleared on events that obviously invalidate the results (such as modifying $PATH)
            – Roger That
            1 hour ago










          • Any idea why which command gives correct path, despite hashNOT being updated?
            – Roger That
            1 hour ago










          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%2f474116%2finstalled-program-executable-runs-from-wrong-location%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          If you had a version installed, then installed another version elsewhere, then your shell will have cached (hashed) the original path. You can clear this cache with hash -r. Then the next time you run the command it will be rehashed with the new path.



          Note that this cache is not global, if you have several running shells you will have to update each of them.



          As to why which sees the correct path, "Why not use which" is a good source of information, but the short answer is that which is an external command that doesn't see the shell's path cache.






          share|improve this answer






















          • Thanks! This worked! I had earlier tried sudo updatedb but that didn't work. I think that hash commands needs to run automatically each time a program is installed.
            – Roger That
            1 hour ago







          • 1




            More info about hash was found here. unix.stackexchange.com/questions/86012/… hash is a bash built-in command. The hash table is a feature of bash that prevents it from having to search $PATH every time you type a command by caching the results in memory. The table gets cleared on events that obviously invalidate the results (such as modifying $PATH)
            – Roger That
            1 hour ago










          • Any idea why which command gives correct path, despite hashNOT being updated?
            – Roger That
            1 hour ago














          up vote
          3
          down vote



          accepted










          If you had a version installed, then installed another version elsewhere, then your shell will have cached (hashed) the original path. You can clear this cache with hash -r. Then the next time you run the command it will be rehashed with the new path.



          Note that this cache is not global, if you have several running shells you will have to update each of them.



          As to why which sees the correct path, "Why not use which" is a good source of information, but the short answer is that which is an external command that doesn't see the shell's path cache.






          share|improve this answer






















          • Thanks! This worked! I had earlier tried sudo updatedb but that didn't work. I think that hash commands needs to run automatically each time a program is installed.
            – Roger That
            1 hour ago







          • 1




            More info about hash was found here. unix.stackexchange.com/questions/86012/… hash is a bash built-in command. The hash table is a feature of bash that prevents it from having to search $PATH every time you type a command by caching the results in memory. The table gets cleared on events that obviously invalidate the results (such as modifying $PATH)
            – Roger That
            1 hour ago










          • Any idea why which command gives correct path, despite hashNOT being updated?
            – Roger That
            1 hour ago












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          If you had a version installed, then installed another version elsewhere, then your shell will have cached (hashed) the original path. You can clear this cache with hash -r. Then the next time you run the command it will be rehashed with the new path.



          Note that this cache is not global, if you have several running shells you will have to update each of them.



          As to why which sees the correct path, "Why not use which" is a good source of information, but the short answer is that which is an external command that doesn't see the shell's path cache.






          share|improve this answer














          If you had a version installed, then installed another version elsewhere, then your shell will have cached (hashed) the original path. You can clear this cache with hash -r. Then the next time you run the command it will be rehashed with the new path.



          Note that this cache is not global, if you have several running shells you will have to update each of them.



          As to why which sees the correct path, "Why not use which" is a good source of information, but the short answer is that which is an external command that doesn't see the shell's path cache.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered 1 hour ago









          Fox

          4,83111131




          4,83111131











          • Thanks! This worked! I had earlier tried sudo updatedb but that didn't work. I think that hash commands needs to run automatically each time a program is installed.
            – Roger That
            1 hour ago







          • 1




            More info about hash was found here. unix.stackexchange.com/questions/86012/… hash is a bash built-in command. The hash table is a feature of bash that prevents it from having to search $PATH every time you type a command by caching the results in memory. The table gets cleared on events that obviously invalidate the results (such as modifying $PATH)
            – Roger That
            1 hour ago










          • Any idea why which command gives correct path, despite hashNOT being updated?
            – Roger That
            1 hour ago
















          • Thanks! This worked! I had earlier tried sudo updatedb but that didn't work. I think that hash commands needs to run automatically each time a program is installed.
            – Roger That
            1 hour ago







          • 1




            More info about hash was found here. unix.stackexchange.com/questions/86012/… hash is a bash built-in command. The hash table is a feature of bash that prevents it from having to search $PATH every time you type a command by caching the results in memory. The table gets cleared on events that obviously invalidate the results (such as modifying $PATH)
            – Roger That
            1 hour ago










          • Any idea why which command gives correct path, despite hashNOT being updated?
            – Roger That
            1 hour ago















          Thanks! This worked! I had earlier tried sudo updatedb but that didn't work. I think that hash commands needs to run automatically each time a program is installed.
          – Roger That
          1 hour ago





          Thanks! This worked! I had earlier tried sudo updatedb but that didn't work. I think that hash commands needs to run automatically each time a program is installed.
          – Roger That
          1 hour ago





          1




          1




          More info about hash was found here. unix.stackexchange.com/questions/86012/… hash is a bash built-in command. The hash table is a feature of bash that prevents it from having to search $PATH every time you type a command by caching the results in memory. The table gets cleared on events that obviously invalidate the results (such as modifying $PATH)
          – Roger That
          1 hour ago




          More info about hash was found here. unix.stackexchange.com/questions/86012/… hash is a bash built-in command. The hash table is a feature of bash that prevents it from having to search $PATH every time you type a command by caching the results in memory. The table gets cleared on events that obviously invalidate the results (such as modifying $PATH)
          – Roger That
          1 hour ago












          Any idea why which command gives correct path, despite hashNOT being updated?
          – Roger That
          1 hour ago




          Any idea why which command gives correct path, despite hashNOT being updated?
          – Roger That
          1 hour ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474116%2finstalled-program-executable-runs-from-wrong-location%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

          Confectionery