Basically, what the title says. I'm setting up a new version of LUA and HAProxy under my user account in Redhat, so the bin directory that contains it is /home/user1/testing/usr/local/bin. I've tried adding this to the PATH in my existing .profile, and .bash_profile files, but when I use which lua, I still get the older version under /usr/bin, in the root directory.

My path looks like this:

echo $PATH

Is there any way for me to do this without overwriting all the other commands?

1 Answer 1


The order of directories in $PATH is significant. When you run command, that will execute the first instance of command found in the directories of your $PATH. Since you have added the new directory at the end, and there is another executable with the same name in an earlier directory, that is the one you find.

So just change the order. I am guessing you have added something like this to your ~/.profile:


You need to change it to this:


You must log in to answer this question.

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