Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have compiled a package named xxx.Now I have deleted the files related with xxx and installed using repository.But if I type command [root]$ xxx , the following message is coming

-bash: /usr/local/bin/xxx: No such file or directory

and if I try, [root]$/usr/bin/xxx -v It is working. Where I want to change the installation location.Or I want to create a symbolic link in /usr/bin/ which points to /usr/local/bin/xxx

share|improve this question
add comment

2 Answers 2

To speed up path name lookups, the shell keeps an internal cache mapping the short names of commands to their full path name. This is probably what you are experiencing here.

You can issue the following command to inspect the current cached path for the program:

hash -t xxx

This will be pointing to the now missing executable. You can clear the cache for a particular name with the following command:

hash -r xxx

Note that this problem will only affect shell sessions that executed the command in the old location. Any new shell sessions should have a clear lookup cache and find the command as expected.

share|improve this answer
add comment

No, you don't want to do any of that. Let me explain why:

/usr/bin is where the applications from the repository are installed. /usr/local/bin is where your compiled applications are installed by default.

When you make && make install an application, you will need to override the repository application, therefore /usr/local/bin is already in your $PATH and it precedes /usr/bin hence it is executed first.

if you type which xxx it will still yield /usr/local/bin/xxx because it is still there where you installed it. Issue rm $(which xxx) or even better, compile the app again but this time issue make uninstall as root.

share|improve this answer
    
If I'm reading the question right, he used to have a version of the program built from source in /usr/local which he has removed. The version in /usr is a standard packaged version of the program. I believe the real problem is the shell lookup cache (as I've detailed in my answer). –  James Henstridge Sep 23 '11 at 1:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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