3

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

2 Answers 2

4

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.

2

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.

1
  • 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). Sep 23, 2011 at 1:09

You must log in to answer this question.

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