tags:

views:

181

answers:

4

The system I am using has gnuplot installed in /usr/bin. I don't have root, but I needed a newer version of gnuplot, so I installed it to $HOME/usr/bin. How to do tell linux to use the one in my home directory and not the one in /usr/bin. I added $HOME/usr/bin to my path, but it still executes the one in /usr/bin if I just use the gnuplot command. I'd rather not have to specify $HOME/usr/bin/gnuplot everytime I have to use it.

Thanks!

+7  A: 

You need to prepend “$HOME/usr/bin” to your path, like so:

export PATH="$HOME/usr/bin:$PATH"
Bombe
+5  A: 

Executables are found in PATH order. Your PATH apparently is set up such that /usr/bin precedes ~/usr/bin/

MSalters
+2  A: 

What Bombe says is ok. I would add that you should declare your user specific PATH entries inside your user's bashrc ($HOME/.bashrc), so your PATH settings only apply to your user.

Fernando Miguélez
He doesn't have root, so I doubt he could globally change the PATH :)
Vinko Vrsalovic
Please re-read my answer. I state that he should change his own user's .bashrc, which is of course writable by the own user (who in fact is the owner of the file).
Fernando Miguélez
+2  A: 

Besides modifying the PATH as has been explained, you can also use aliases like this (in BASH)

alias gn=$HOME/usr/bin/gnuplot

then you just run it with

gn
Vinko Vrsalovic
Not so sure hard coding a path is a good idea for an alias. I would rather use it to specify flags that I always wanted.
Martin York
In this case, where you want a specific version of a program, I see no problem at all.
Vinko Vrsalovic