56

Possible Duplicate:
How to add a directory to my path?

I need to use a program in my job. I followed the installation instructions of this PROGRAM. However, when I try to run it the message appears - program_that_I_want_to_run:Command not found

I know that it is a $PATH problem, but I tried the command line described in the instructions and it did not work.

  1. Set environment variable CONFIG_PATH

    export CONFIG_PATH=/my_path_to_PROGRAM/PROGRAM/config/

I am sure that I indicated correctly the path to access the config directory. No typing errors.

Help?

1
  • 1
    Is it really necessary to obscificate your question ? It would be much easier to help you if you specified your program, how you installed it, and what the full path was. I am not sure if you need export CONFIG_PATH=/my_path_to_PROGRAM/PROGRAM/config/ as your error message is one of PATH and not necessarily configuration, hard to know from what little you posted.
    – Panther
    Mar 2, 2012 at 13:13

2 Answers 2

73

Firstly, check your original path:

echo $PATH

It should show something like this:

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

Now add your program to that path, ensuring your using the entire path all the way from / to your program.

export PATH=$PATH:/path/to/my/program

This sets your PATH variable to the existing PATH plus what you add to the end. Check that it has been added (Caveat: it presist only in the current session of the terminal):

echo $PATH
4
  • 14
    Is this permanent?
    – chwi
    Nov 10, 2012 at 12:17
  • 3
    no this is not permanent, as i closed the terminal, reopen it and type 'echo $PATH'.. it didn't show me my new path in it.
    – Farhan
    Dec 24, 2013 at 9:50
  • 8
    If you want to make the change permanent, add this exact command to the end of ~/.bashrc
    – Alex Lomia
    Mar 29, 2016 at 19:29
  • @AlexLomia: You are the king!
    – JAN
    Aug 2, 2022 at 14:15
23

Add this line to ~/.bashrc (you use PATH rather then CONFIG_PATH)

export PATH=$PATH:/path/to_directory_containing_program
export CONFIG_PATH=/my_path_to_PROGRAM/PROGRAM/config/
5
  • 6
    Environment variables should be set in either ~/.pam_environment or ~/.profile, not ~/.bashrc.
    – geirha
    Mar 2, 2012 at 14:45
  • 7
  • @galath- You do understand that this question is both a duplicate and over 3 years old ? The link you give is more recent then the original question.
    – Panther
    May 30, 2015 at 15:08
  • 5
    I came to this page from google and appreciate galaths comment a lot. Thanks
    – offroff
    Jul 3, 2015 at 9:40
  • How to use that all without leaving terminal? Jul 5, 2022 at 7:17

Not the answer you're looking for? Browse other questions tagged .