Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
How do I set PATH and other environment variables?

I would like to put the path of a binary in my bash profile which is not present in the usual location like /usr/bin or /sbin. For example, if the following is the path of the binary:

/path/to/bin

How would I put this path permanently in my bash profile so that every time I login I don't need to specify the path of the binary?

share|improve this question

migrated from stackoverflow.com Aug 18 '11 at 14:22

This question came from our site for professional and enthusiast programmers.

marked as duplicate by slhck, random Aug 19 '11 at 12:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
possible duplicate of How do I set PATH and other environment variables?, especially this answer which would explain the syntax. –  slhck Aug 18 '11 at 16:46

1 Answer 1

You should edit your ~/.bashrc, and add something like:

export PATH=$PATH:/path/to/bin
share|improve this answer
    
I did the same but i am not seeing the path after running the command $PATH from terminal. Do i need to do restart? Is there any command for it? –  thetna Aug 18 '11 at 13:54
    
You need to start a new shell. To have an immediate effect, you can also type source ~/.bashrc (or simply . ~/.bashrc). –  Oli Charlesworth Aug 18 '11 at 13:55
    
type source ~/.bashrc to get it to update the PATH immediately. –  arunkumar Aug 18 '11 at 13:56
    
the bash profile is only read when you login to that terminal. Start a new terminal, and echo $PATH should be correct. –  Simon Elliston Ball Aug 18 '11 at 13:56
    
I am getting following error bash: export: `=/usr/local/bin:/usr/bin:/bin:/path/to/bin not a valid identifier.Even $PATH does not show the path i have added. –  thetna Aug 18 '11 at 14:00