Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have this problem where I sometimes reinstall software in /usr/local that was previously installed in /usr . After uninstalling what is in /usr, I run the command at I get something like:
r@pal:~$ pd
bash: /usr/bin/pd: No such file or directory
This is because pd is now in /usr/local/bin:
r@pal:~$ which pd
/usr/local/bin/pd
But this has not been recognized by bash, and won't be until i reboot. Is there any way to manually update this?
It is better to edit ~/.profile to add directories in your path. This bash script is executed when you log in. Bashrc might not be unless .profile sources it. And in that case, when opening a konsole or xterm or running a subshell the directories will be added again.
See the info bash manual. There could be a different bash startup file used instead such as .bash_login or .bash_profile. The info manual outlines the precedence. For most Linux distro's .profile is used but you can never be certain without checking.
It sounds like, maybe, your issue is also with the way bash is hashing recently used commands. Any shock (like a reboot) to the shell will cause it to dump (and forget that /usr/bin/somecommand is there when it's not), so all the other suggestions are excellent and valid. I just wanted to put these 2 cents in, in case it helps.
"hash -r" might be an easy way for you to just get it over with and not wait
It is better to edit ~/.profile to add directories in your path. This bash script is executed when you log in. Bashrc might not be unless .profile sources it. And in that case, when opening a konsole or xterm or running a subshell the directories will be added again.
See the info bash manual. There could be a different bash startup file used instead such as .bash_login or .bash_profile. The info manual outlines the precedence. For most Linux distro's .profile is used but you can never be certain without checking.
The distro doesn't matter, and it's a bash thing only.
.profile might not be the right file either.
For interactive non-login sessions (i.e. xterm and the likes) use .bashrc, for login shells (when login in text mode, via ssh, etc) use .bash_profile, which will take precedence over any other. For global configs use /etc/profile.
More info in the "INVOCATION" section of the bash man page.
However, this is NOT a PATH issue. If /usr/local/bin wasn't in the path, no amount of reboot would help, right? So I guess that it's eggixyz who hit the nail.
About the source (or dot) command, it's a bash builtin which dumps a given shell script into the current shell, as if you typed all the commands into that file in your command line, hence, all the environment of that shell script is merged into your current shell (including whatever modifications to PATH have been done).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.