I am doing this:
$ which cabal
/usr/bin/cabal
$ export PATH=$PATH:$HOME/.cabal/bin
$ which cabal
/usr/bin/cabal
I expect to get /.cabal/bin/cabal for $ which cabal (this path exists) after this. But I don't even after re-opening the terminal. How come?
export PATH=$HOME/.cabal/bin:$PATH-- with$PATHafter$HOME/.cabal/bin. In case it's not clear, this works by concatenating the old value of$PATHwith some new value(s). Analogy:WORD=bar; WORD=foo$WORD->$WORDis nowfoobar. WRT$PATH, don't forget the colon in between. – goldilocks Jul 14 '14 at 12:18exitthe shell/terminal you're using --exportapplies it to the current shell and all its children, not everything that's running. If you put it in.bash_profileor something, just change it and log in again. In any case, it's harmless to add the path at the beginning and leave it at the end as well. – goldilocks Jul 14 '14 at 13:10export PATH=$HOME/bin:$PATH- in the beginning or in the end of .bash_profile? – Incerteza Jul 14 '14 at 13:57.xsessionfile or put it in.bashrc, in which case you may want to read this: http://unix.stackexchange.com/questions/124444/how-can-i-cleanly-add-to-path – goldilocks Jul 14 '14 at 14:55.bash_profile, but they do use.xsession-- so if yousource ~/.bash_profilein~/.xsessionit will work. http://unix.stackexchange.com/questions/47359/what-is-xsession-for – goldilocks Jul 14 '14 at 14:59