Problem with $PATH and executable file











up vote
7
down vote

favorite
3












I have a unix executable file located in a directory I generated. I believe I need to get this directory in my $PATH so that the unix executable is executable, but the documentation for the source code says that I need to edit my shell configuration file to add $home/meme/bin to my shell's path.










share|improve this question




























    up vote
    7
    down vote

    favorite
    3












    I have a unix executable file located in a directory I generated. I believe I need to get this directory in my $PATH so that the unix executable is executable, but the documentation for the source code says that I need to edit my shell configuration file to add $home/meme/bin to my shell's path.










    share|improve this question


























      up vote
      7
      down vote

      favorite
      3









      up vote
      7
      down vote

      favorite
      3






      3





      I have a unix executable file located in a directory I generated. I believe I need to get this directory in my $PATH so that the unix executable is executable, but the documentation for the source code says that I need to edit my shell configuration file to add $home/meme/bin to my shell's path.










      share|improve this question















      I have a unix executable file located in a directory I generated. I believe I need to get this directory in my $PATH so that the unix executable is executable, but the documentation for the source code says that I need to edit my shell configuration file to add $home/meme/bin to my shell's path.







      executable path






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago









      Rui F Ribeiro

      38.2k1475123




      38.2k1475123










      asked Jul 7 '11 at 19:30









      dr.bunsen

      5693711




      5693711






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          9
          down vote



          accepted










          If you want to be able to execute a program by typing its name on the command line, the program executable must be in one of the directories listed in the PATH environment variable. You can see the current value of the variable like this ($ is your prompt, and the value below is an example):



          $ echo $PATH
          /home/drbunsen/bin:/usr/local/bin:/usr/bin:/bin


          You have several choices; while #1 and #2 involve less advanced concepts, I recommend #3 which is less work in practice:




          • You can put the executable in a directory that's already on your PATH. For example, if /home/drbunsen/bin is already on your PATH, you can put the executable there. Or you can put the executable in /usr/local/bin if you want it to be available for all users.


          • You can add the directory where the executable is in your PATH. Edit the file ~/.profile (~/ means that the file is in your home directory) (create the file if it doesn't exist). Add a line like this:



            PATH=$PATH:$HOME/meme/bin


            (Note that it's $HOME, not $home; unix is generally case-sensitive. You can also write ~/meme/bin, ~ is a synonym for $HOME when it's at the beginning of a file path.) The change will take effect the next time you log in. You can type this same line in a terminal, and it will affect the shell running in that terminal and any program launched from it.




          • The approach I recommend is to keep the executable with the other files that are part of the program, in a directory of its own, but not to change PATH either.

            Keeping the executable in $HOME/meme has the advantage that if you ever want to remove or upgrade the program, everything is in one place. Some programs even require this in order to find the files they use. Not changing PATH has the advantage that installing and uninstalling programs is less work.

            To get the best of both worlds, create a symbolic link in a directory on your PATH, pointing to the actual executable. From the command line, run a command like this:



            cd ~/bin
            ln -s ../meme/bin/* .


            That's assuming that ~/bin is already on your PATH; if it's not, add it through ~/.profile as indicated above. Pick another location if you like. Now making programs available is a matter of creating the symbolic links; making them unavailable is a matter of removing the symbolic links; and you can easily track what programs you've installed manually and where they live by looking at the symbolic links.








          share|improve this answer





















          • Gilles, wow thank you SO MUCH for the detailed explanation. I really appreciate your help. Thanks for taking the time to answer my question in detail and at a level that made everything crystal clear.
            – dr.bunsen
            Jul 7 '11 at 22:41










          • Another thing that I noticed is that in the home/meme/ directory there doesn't appear to be a /bin directory. Do I need to create bin so that I can make a symbolic link in here to my PATH? Thanks.
            – dr.bunsen
            Jul 7 '11 at 22:49










          • @dr.bunsen ~/bin is a common location, and some distributions create it automatically. If yours doesn't, you'll have to create it and add it to PATH manually. The location ~/bin is just a convention, you can pick another name if you like.
            – Gilles
            Jul 7 '11 at 22:56










          • The wildcard command does not work because ln interprets the last item in the expansion as a directory: "Usage: ln [OPTION]... [-T] TARGET LINK_NAME (1st form) or: ln [OPTION]... TARGET (2nd form) or: ln [OPTION]... TARGET... DIRECTORY (3rd form) or: ln [OPTION]... -t DIRECTORY TARGET... (4th form) " To solve this, I added "-t ./"
            – adam.r
            May 25 '14 at 22:18






          • 1




            @adam.r I wrote ln -s ../meme/bin/* ., not ln -s ../meme/bin/*. Looks like you missed one character when copying the command.
            – Gilles
            May 25 '14 at 22:19


















          up vote
          4
          down vote













          You can add the new directory to your PATH temporarily, meaning for the duration of the current terminal session, with



          $ export PATH=$HOME/meme/bin:$PATH


          This adds the new directory to the beginning of the PATH variable, while retaining all existing directories.



          If you want the modification to take effect permanently, in all future terminal sessions, you need to add the above line to the appropriate profile file in your home directory. Depending on how your distribution is set up, this might be called ~/.bash_profile, ~/.profile or something similar.



          Note also that you do not need to add a directory to your $PATH in order to execute a program inside it, you can also invoke the program by giving its full path, e.g.



          $ $HOME/meme/bin/program_name


          or



          $ ./program_name


          if it is in the current directory.






          share|improve this answer



















          • 1




            ~/.bashrc isn't the place to put environment variable definitions; see Difference between .bashrc and .bash_profile
            – Gilles
            Jul 7 '11 at 20:35










          • @Gilles - you're right, edited.
            – TooManyKooks
            Jul 7 '11 at 21:05











          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: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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%2funix.stackexchange.com%2fquestions%2f16242%2fproblem-with-path-and-executable-file%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
          9
          down vote



          accepted










          If you want to be able to execute a program by typing its name on the command line, the program executable must be in one of the directories listed in the PATH environment variable. You can see the current value of the variable like this ($ is your prompt, and the value below is an example):



          $ echo $PATH
          /home/drbunsen/bin:/usr/local/bin:/usr/bin:/bin


          You have several choices; while #1 and #2 involve less advanced concepts, I recommend #3 which is less work in practice:




          • You can put the executable in a directory that's already on your PATH. For example, if /home/drbunsen/bin is already on your PATH, you can put the executable there. Or you can put the executable in /usr/local/bin if you want it to be available for all users.


          • You can add the directory where the executable is in your PATH. Edit the file ~/.profile (~/ means that the file is in your home directory) (create the file if it doesn't exist). Add a line like this:



            PATH=$PATH:$HOME/meme/bin


            (Note that it's $HOME, not $home; unix is generally case-sensitive. You can also write ~/meme/bin, ~ is a synonym for $HOME when it's at the beginning of a file path.) The change will take effect the next time you log in. You can type this same line in a terminal, and it will affect the shell running in that terminal and any program launched from it.




          • The approach I recommend is to keep the executable with the other files that are part of the program, in a directory of its own, but not to change PATH either.

            Keeping the executable in $HOME/meme has the advantage that if you ever want to remove or upgrade the program, everything is in one place. Some programs even require this in order to find the files they use. Not changing PATH has the advantage that installing and uninstalling programs is less work.

            To get the best of both worlds, create a symbolic link in a directory on your PATH, pointing to the actual executable. From the command line, run a command like this:



            cd ~/bin
            ln -s ../meme/bin/* .


            That's assuming that ~/bin is already on your PATH; if it's not, add it through ~/.profile as indicated above. Pick another location if you like. Now making programs available is a matter of creating the symbolic links; making them unavailable is a matter of removing the symbolic links; and you can easily track what programs you've installed manually and where they live by looking at the symbolic links.








          share|improve this answer





















          • Gilles, wow thank you SO MUCH for the detailed explanation. I really appreciate your help. Thanks for taking the time to answer my question in detail and at a level that made everything crystal clear.
            – dr.bunsen
            Jul 7 '11 at 22:41










          • Another thing that I noticed is that in the home/meme/ directory there doesn't appear to be a /bin directory. Do I need to create bin so that I can make a symbolic link in here to my PATH? Thanks.
            – dr.bunsen
            Jul 7 '11 at 22:49










          • @dr.bunsen ~/bin is a common location, and some distributions create it automatically. If yours doesn't, you'll have to create it and add it to PATH manually. The location ~/bin is just a convention, you can pick another name if you like.
            – Gilles
            Jul 7 '11 at 22:56










          • The wildcard command does not work because ln interprets the last item in the expansion as a directory: "Usage: ln [OPTION]... [-T] TARGET LINK_NAME (1st form) or: ln [OPTION]... TARGET (2nd form) or: ln [OPTION]... TARGET... DIRECTORY (3rd form) or: ln [OPTION]... -t DIRECTORY TARGET... (4th form) " To solve this, I added "-t ./"
            – adam.r
            May 25 '14 at 22:18






          • 1




            @adam.r I wrote ln -s ../meme/bin/* ., not ln -s ../meme/bin/*. Looks like you missed one character when copying the command.
            – Gilles
            May 25 '14 at 22:19















          up vote
          9
          down vote



          accepted










          If you want to be able to execute a program by typing its name on the command line, the program executable must be in one of the directories listed in the PATH environment variable. You can see the current value of the variable like this ($ is your prompt, and the value below is an example):



          $ echo $PATH
          /home/drbunsen/bin:/usr/local/bin:/usr/bin:/bin


          You have several choices; while #1 and #2 involve less advanced concepts, I recommend #3 which is less work in practice:




          • You can put the executable in a directory that's already on your PATH. For example, if /home/drbunsen/bin is already on your PATH, you can put the executable there. Or you can put the executable in /usr/local/bin if you want it to be available for all users.


          • You can add the directory where the executable is in your PATH. Edit the file ~/.profile (~/ means that the file is in your home directory) (create the file if it doesn't exist). Add a line like this:



            PATH=$PATH:$HOME/meme/bin


            (Note that it's $HOME, not $home; unix is generally case-sensitive. You can also write ~/meme/bin, ~ is a synonym for $HOME when it's at the beginning of a file path.) The change will take effect the next time you log in. You can type this same line in a terminal, and it will affect the shell running in that terminal and any program launched from it.




          • The approach I recommend is to keep the executable with the other files that are part of the program, in a directory of its own, but not to change PATH either.

            Keeping the executable in $HOME/meme has the advantage that if you ever want to remove or upgrade the program, everything is in one place. Some programs even require this in order to find the files they use. Not changing PATH has the advantage that installing and uninstalling programs is less work.

            To get the best of both worlds, create a symbolic link in a directory on your PATH, pointing to the actual executable. From the command line, run a command like this:



            cd ~/bin
            ln -s ../meme/bin/* .


            That's assuming that ~/bin is already on your PATH; if it's not, add it through ~/.profile as indicated above. Pick another location if you like. Now making programs available is a matter of creating the symbolic links; making them unavailable is a matter of removing the symbolic links; and you can easily track what programs you've installed manually and where they live by looking at the symbolic links.








          share|improve this answer





















          • Gilles, wow thank you SO MUCH for the detailed explanation. I really appreciate your help. Thanks for taking the time to answer my question in detail and at a level that made everything crystal clear.
            – dr.bunsen
            Jul 7 '11 at 22:41










          • Another thing that I noticed is that in the home/meme/ directory there doesn't appear to be a /bin directory. Do I need to create bin so that I can make a symbolic link in here to my PATH? Thanks.
            – dr.bunsen
            Jul 7 '11 at 22:49










          • @dr.bunsen ~/bin is a common location, and some distributions create it automatically. If yours doesn't, you'll have to create it and add it to PATH manually. The location ~/bin is just a convention, you can pick another name if you like.
            – Gilles
            Jul 7 '11 at 22:56










          • The wildcard command does not work because ln interprets the last item in the expansion as a directory: "Usage: ln [OPTION]... [-T] TARGET LINK_NAME (1st form) or: ln [OPTION]... TARGET (2nd form) or: ln [OPTION]... TARGET... DIRECTORY (3rd form) or: ln [OPTION]... -t DIRECTORY TARGET... (4th form) " To solve this, I added "-t ./"
            – adam.r
            May 25 '14 at 22:18






          • 1




            @adam.r I wrote ln -s ../meme/bin/* ., not ln -s ../meme/bin/*. Looks like you missed one character when copying the command.
            – Gilles
            May 25 '14 at 22:19













          up vote
          9
          down vote



          accepted







          up vote
          9
          down vote



          accepted






          If you want to be able to execute a program by typing its name on the command line, the program executable must be in one of the directories listed in the PATH environment variable. You can see the current value of the variable like this ($ is your prompt, and the value below is an example):



          $ echo $PATH
          /home/drbunsen/bin:/usr/local/bin:/usr/bin:/bin


          You have several choices; while #1 and #2 involve less advanced concepts, I recommend #3 which is less work in practice:




          • You can put the executable in a directory that's already on your PATH. For example, if /home/drbunsen/bin is already on your PATH, you can put the executable there. Or you can put the executable in /usr/local/bin if you want it to be available for all users.


          • You can add the directory where the executable is in your PATH. Edit the file ~/.profile (~/ means that the file is in your home directory) (create the file if it doesn't exist). Add a line like this:



            PATH=$PATH:$HOME/meme/bin


            (Note that it's $HOME, not $home; unix is generally case-sensitive. You can also write ~/meme/bin, ~ is a synonym for $HOME when it's at the beginning of a file path.) The change will take effect the next time you log in. You can type this same line in a terminal, and it will affect the shell running in that terminal and any program launched from it.




          • The approach I recommend is to keep the executable with the other files that are part of the program, in a directory of its own, but not to change PATH either.

            Keeping the executable in $HOME/meme has the advantage that if you ever want to remove or upgrade the program, everything is in one place. Some programs even require this in order to find the files they use. Not changing PATH has the advantage that installing and uninstalling programs is less work.

            To get the best of both worlds, create a symbolic link in a directory on your PATH, pointing to the actual executable. From the command line, run a command like this:



            cd ~/bin
            ln -s ../meme/bin/* .


            That's assuming that ~/bin is already on your PATH; if it's not, add it through ~/.profile as indicated above. Pick another location if you like. Now making programs available is a matter of creating the symbolic links; making them unavailable is a matter of removing the symbolic links; and you can easily track what programs you've installed manually and where they live by looking at the symbolic links.








          share|improve this answer












          If you want to be able to execute a program by typing its name on the command line, the program executable must be in one of the directories listed in the PATH environment variable. You can see the current value of the variable like this ($ is your prompt, and the value below is an example):



          $ echo $PATH
          /home/drbunsen/bin:/usr/local/bin:/usr/bin:/bin


          You have several choices; while #1 and #2 involve less advanced concepts, I recommend #3 which is less work in practice:




          • You can put the executable in a directory that's already on your PATH. For example, if /home/drbunsen/bin is already on your PATH, you can put the executable there. Or you can put the executable in /usr/local/bin if you want it to be available for all users.


          • You can add the directory where the executable is in your PATH. Edit the file ~/.profile (~/ means that the file is in your home directory) (create the file if it doesn't exist). Add a line like this:



            PATH=$PATH:$HOME/meme/bin


            (Note that it's $HOME, not $home; unix is generally case-sensitive. You can also write ~/meme/bin, ~ is a synonym for $HOME when it's at the beginning of a file path.) The change will take effect the next time you log in. You can type this same line in a terminal, and it will affect the shell running in that terminal and any program launched from it.




          • The approach I recommend is to keep the executable with the other files that are part of the program, in a directory of its own, but not to change PATH either.

            Keeping the executable in $HOME/meme has the advantage that if you ever want to remove or upgrade the program, everything is in one place. Some programs even require this in order to find the files they use. Not changing PATH has the advantage that installing and uninstalling programs is less work.

            To get the best of both worlds, create a symbolic link in a directory on your PATH, pointing to the actual executable. From the command line, run a command like this:



            cd ~/bin
            ln -s ../meme/bin/* .


            That's assuming that ~/bin is already on your PATH; if it's not, add it through ~/.profile as indicated above. Pick another location if you like. Now making programs available is a matter of creating the symbolic links; making them unavailable is a matter of removing the symbolic links; and you can easily track what programs you've installed manually and where they live by looking at the symbolic links.









          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 7 '11 at 20:34









          Gilles

          521k12610401570




          521k12610401570












          • Gilles, wow thank you SO MUCH for the detailed explanation. I really appreciate your help. Thanks for taking the time to answer my question in detail and at a level that made everything crystal clear.
            – dr.bunsen
            Jul 7 '11 at 22:41










          • Another thing that I noticed is that in the home/meme/ directory there doesn't appear to be a /bin directory. Do I need to create bin so that I can make a symbolic link in here to my PATH? Thanks.
            – dr.bunsen
            Jul 7 '11 at 22:49










          • @dr.bunsen ~/bin is a common location, and some distributions create it automatically. If yours doesn't, you'll have to create it and add it to PATH manually. The location ~/bin is just a convention, you can pick another name if you like.
            – Gilles
            Jul 7 '11 at 22:56










          • The wildcard command does not work because ln interprets the last item in the expansion as a directory: "Usage: ln [OPTION]... [-T] TARGET LINK_NAME (1st form) or: ln [OPTION]... TARGET (2nd form) or: ln [OPTION]... TARGET... DIRECTORY (3rd form) or: ln [OPTION]... -t DIRECTORY TARGET... (4th form) " To solve this, I added "-t ./"
            – adam.r
            May 25 '14 at 22:18






          • 1




            @adam.r I wrote ln -s ../meme/bin/* ., not ln -s ../meme/bin/*. Looks like you missed one character when copying the command.
            – Gilles
            May 25 '14 at 22:19


















          • Gilles, wow thank you SO MUCH for the detailed explanation. I really appreciate your help. Thanks for taking the time to answer my question in detail and at a level that made everything crystal clear.
            – dr.bunsen
            Jul 7 '11 at 22:41










          • Another thing that I noticed is that in the home/meme/ directory there doesn't appear to be a /bin directory. Do I need to create bin so that I can make a symbolic link in here to my PATH? Thanks.
            – dr.bunsen
            Jul 7 '11 at 22:49










          • @dr.bunsen ~/bin is a common location, and some distributions create it automatically. If yours doesn't, you'll have to create it and add it to PATH manually. The location ~/bin is just a convention, you can pick another name if you like.
            – Gilles
            Jul 7 '11 at 22:56










          • The wildcard command does not work because ln interprets the last item in the expansion as a directory: "Usage: ln [OPTION]... [-T] TARGET LINK_NAME (1st form) or: ln [OPTION]... TARGET (2nd form) or: ln [OPTION]... TARGET... DIRECTORY (3rd form) or: ln [OPTION]... -t DIRECTORY TARGET... (4th form) " To solve this, I added "-t ./"
            – adam.r
            May 25 '14 at 22:18






          • 1




            @adam.r I wrote ln -s ../meme/bin/* ., not ln -s ../meme/bin/*. Looks like you missed one character when copying the command.
            – Gilles
            May 25 '14 at 22:19
















          Gilles, wow thank you SO MUCH for the detailed explanation. I really appreciate your help. Thanks for taking the time to answer my question in detail and at a level that made everything crystal clear.
          – dr.bunsen
          Jul 7 '11 at 22:41




          Gilles, wow thank you SO MUCH for the detailed explanation. I really appreciate your help. Thanks for taking the time to answer my question in detail and at a level that made everything crystal clear.
          – dr.bunsen
          Jul 7 '11 at 22:41












          Another thing that I noticed is that in the home/meme/ directory there doesn't appear to be a /bin directory. Do I need to create bin so that I can make a symbolic link in here to my PATH? Thanks.
          – dr.bunsen
          Jul 7 '11 at 22:49




          Another thing that I noticed is that in the home/meme/ directory there doesn't appear to be a /bin directory. Do I need to create bin so that I can make a symbolic link in here to my PATH? Thanks.
          – dr.bunsen
          Jul 7 '11 at 22:49












          @dr.bunsen ~/bin is a common location, and some distributions create it automatically. If yours doesn't, you'll have to create it and add it to PATH manually. The location ~/bin is just a convention, you can pick another name if you like.
          – Gilles
          Jul 7 '11 at 22:56




          @dr.bunsen ~/bin is a common location, and some distributions create it automatically. If yours doesn't, you'll have to create it and add it to PATH manually. The location ~/bin is just a convention, you can pick another name if you like.
          – Gilles
          Jul 7 '11 at 22:56












          The wildcard command does not work because ln interprets the last item in the expansion as a directory: "Usage: ln [OPTION]... [-T] TARGET LINK_NAME (1st form) or: ln [OPTION]... TARGET (2nd form) or: ln [OPTION]... TARGET... DIRECTORY (3rd form) or: ln [OPTION]... -t DIRECTORY TARGET... (4th form) " To solve this, I added "-t ./"
          – adam.r
          May 25 '14 at 22:18




          The wildcard command does not work because ln interprets the last item in the expansion as a directory: "Usage: ln [OPTION]... [-T] TARGET LINK_NAME (1st form) or: ln [OPTION]... TARGET (2nd form) or: ln [OPTION]... TARGET... DIRECTORY (3rd form) or: ln [OPTION]... -t DIRECTORY TARGET... (4th form) " To solve this, I added "-t ./"
          – adam.r
          May 25 '14 at 22:18




          1




          1




          @adam.r I wrote ln -s ../meme/bin/* ., not ln -s ../meme/bin/*. Looks like you missed one character when copying the command.
          – Gilles
          May 25 '14 at 22:19




          @adam.r I wrote ln -s ../meme/bin/* ., not ln -s ../meme/bin/*. Looks like you missed one character when copying the command.
          – Gilles
          May 25 '14 at 22:19












          up vote
          4
          down vote













          You can add the new directory to your PATH temporarily, meaning for the duration of the current terminal session, with



          $ export PATH=$HOME/meme/bin:$PATH


          This adds the new directory to the beginning of the PATH variable, while retaining all existing directories.



          If you want the modification to take effect permanently, in all future terminal sessions, you need to add the above line to the appropriate profile file in your home directory. Depending on how your distribution is set up, this might be called ~/.bash_profile, ~/.profile or something similar.



          Note also that you do not need to add a directory to your $PATH in order to execute a program inside it, you can also invoke the program by giving its full path, e.g.



          $ $HOME/meme/bin/program_name


          or



          $ ./program_name


          if it is in the current directory.






          share|improve this answer



















          • 1




            ~/.bashrc isn't the place to put environment variable definitions; see Difference between .bashrc and .bash_profile
            – Gilles
            Jul 7 '11 at 20:35










          • @Gilles - you're right, edited.
            – TooManyKooks
            Jul 7 '11 at 21:05















          up vote
          4
          down vote













          You can add the new directory to your PATH temporarily, meaning for the duration of the current terminal session, with



          $ export PATH=$HOME/meme/bin:$PATH


          This adds the new directory to the beginning of the PATH variable, while retaining all existing directories.



          If you want the modification to take effect permanently, in all future terminal sessions, you need to add the above line to the appropriate profile file in your home directory. Depending on how your distribution is set up, this might be called ~/.bash_profile, ~/.profile or something similar.



          Note also that you do not need to add a directory to your $PATH in order to execute a program inside it, you can also invoke the program by giving its full path, e.g.



          $ $HOME/meme/bin/program_name


          or



          $ ./program_name


          if it is in the current directory.






          share|improve this answer



















          • 1




            ~/.bashrc isn't the place to put environment variable definitions; see Difference between .bashrc and .bash_profile
            – Gilles
            Jul 7 '11 at 20:35










          • @Gilles - you're right, edited.
            – TooManyKooks
            Jul 7 '11 at 21:05













          up vote
          4
          down vote










          up vote
          4
          down vote









          You can add the new directory to your PATH temporarily, meaning for the duration of the current terminal session, with



          $ export PATH=$HOME/meme/bin:$PATH


          This adds the new directory to the beginning of the PATH variable, while retaining all existing directories.



          If you want the modification to take effect permanently, in all future terminal sessions, you need to add the above line to the appropriate profile file in your home directory. Depending on how your distribution is set up, this might be called ~/.bash_profile, ~/.profile or something similar.



          Note also that you do not need to add a directory to your $PATH in order to execute a program inside it, you can also invoke the program by giving its full path, e.g.



          $ $HOME/meme/bin/program_name


          or



          $ ./program_name


          if it is in the current directory.






          share|improve this answer














          You can add the new directory to your PATH temporarily, meaning for the duration of the current terminal session, with



          $ export PATH=$HOME/meme/bin:$PATH


          This adds the new directory to the beginning of the PATH variable, while retaining all existing directories.



          If you want the modification to take effect permanently, in all future terminal sessions, you need to add the above line to the appropriate profile file in your home directory. Depending on how your distribution is set up, this might be called ~/.bash_profile, ~/.profile or something similar.



          Note also that you do not need to add a directory to your $PATH in order to execute a program inside it, you can also invoke the program by giving its full path, e.g.



          $ $HOME/meme/bin/program_name


          or



          $ ./program_name


          if it is in the current directory.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 7 '11 at 21:04

























          answered Jul 7 '11 at 20:16









          TooManyKooks

          75148




          75148








          • 1




            ~/.bashrc isn't the place to put environment variable definitions; see Difference between .bashrc and .bash_profile
            – Gilles
            Jul 7 '11 at 20:35










          • @Gilles - you're right, edited.
            – TooManyKooks
            Jul 7 '11 at 21:05














          • 1




            ~/.bashrc isn't the place to put environment variable definitions; see Difference between .bashrc and .bash_profile
            – Gilles
            Jul 7 '11 at 20:35










          • @Gilles - you're right, edited.
            – TooManyKooks
            Jul 7 '11 at 21:05








          1




          1




          ~/.bashrc isn't the place to put environment variable definitions; see Difference between .bashrc and .bash_profile
          – Gilles
          Jul 7 '11 at 20:35




          ~/.bashrc isn't the place to put environment variable definitions; see Difference between .bashrc and .bash_profile
          – Gilles
          Jul 7 '11 at 20:35












          @Gilles - you're right, edited.
          – TooManyKooks
          Jul 7 '11 at 21:05




          @Gilles - you're right, edited.
          – TooManyKooks
          Jul 7 '11 at 21:05


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f16242%2fproblem-with-path-and-executable-file%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

          サソリ

          広島県道265号伴広島線

          Accessing regular linux commands in Huawei's Dopra Linux