Tuesday, May 1, 2012

Linux / BSD Shell Doesn't Recognize Newly Installed Binaries

I've installed few software using tar ball format under Linux or FreeBSD ports using make command. However, my system doesn't recognize the installed command. I've to reboot the system or log out and log in again to use the same. How do I fix this problem?

Almost all modern shell remembers program location and cache the result to speed up operation. Shell has something called hash table which is nothing but the contents of the directories in the path ($PATH) variable to be recomputed. To flush cache simply type the following under bash:
# hash -r
If you are using CSH, type:
# rehash
This is needed if new commands are added to directories in path while you are logged in. This should be necessary only if you add commands to one of your own directories, or if a systems programmer changes the contents of one of the system directories. Also flushes the cache of home directories built by tilde expansion.

No comments:

Post a Comment