Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I downloaded the latest version of Scala and saved it to /opt folder. Then I tried to add /opt/scala-2.11.2/bin to the PATH in order to have easier access to commands like scala and scalac. After executing the command :

export PATH=$PATH:/opt/scala-2.11.2/bin/

and then :

echo $PATH

I see the path in there. At that time I can also use the commands scala and scalac.

Then if I close the terminal and restart , the path /opt/scala-2.11.2/bin/ is not in echo $PATH anymore. And thus I can not execute the commands . What is my problem ?

share|improve this question

marked as duplicate by Radu Rădeanu command-line Aug 7 '14 at 16:48

This question was marked as an exact duplicate of an existing question.

Add it to your .profile file, here an example – tttony Aug 7 '14 at 16:28
This is what I have done. Still does not work. # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH:$/opt/scala-2.11.2/bin" fi – billpcs Aug 7 '14 at 16:31
You have to do it outside of the if .. then, because $HOME/bin does not exists, put it in the last line of the .profile file – tttony Aug 7 '14 at 16:33

put that command at the end of the file .bashrc inside your home directory than do a

source .bashrc

share|improve this answer
Ok it worked. Thank you! – billpcs Aug 7 '14 at 16:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.