[SOLVED] How to move /usr/local/bin from the beginning of the path?
Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
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.
How to move /usr/local/bin from the beginning of the path?
This may sound like a silly basic LFS question but I cannot figure out how move /usr/local/bin from the beginning of my environment $PATH. I want it to be the last path rather than the first path. Current path:
echo $PATH /usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/opt/qt5/bin
Having /usr/local/bin at the start has caused me problems a few times when I have accidentally installed stuff there.
My home folder's .bash_profile is:
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/qt5/bin
if [ -f "$HOME/.bashrc" ] ; then
source $HOME/.bashrc
fi
if [ -d "$HOME/bin" ] ; then
pathprepend $HOME/bin
fi
I have no .bashrc in my home folder.
System-wide scripts in /etc must be prepending /usr/local/bin to my path but I can't figure out which
script is doing it or what modifications to make. Can anyone help?
Using LFS/BLFS 8.0.
You know...I'd call up the PATH, copy n paste it in the mousepad, cut n paste around so the thing is in your order and re-set the PATH in a terminal...
But...I keep things simple...
Kisses
Melissa
Thanks, Hazel, but that didn't work. What I discovered while monkeying however is that my .bash_profile is not even being sourced. After a fresh boot
echo $PATH /usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/opt/qt5/bin
After I manually run
source .bash_profile
echo $PATH /bin:/usr/bin:/sbin:/usr/sbin:/opt/qt5/bin
so I must have bollixed up something somewhere if .bash_profile in
my home folder is not even being used. I'll keep working on it.
Thanks, ButterflyMelissa. Is it really that simple? I still have to figure out why
.bash_profile isn't getting sourced though. Just because I like to know what's
going on.
Well, I finally found the file which was offending me. It is /etc/profile.d/extrapaths.sh
I commented out the part that had been making me annoyed.
This was the relevant part, commented out now:
#if [ -d /usr/local/bin ]; then
#pathprepend /usr/local/bin
#fi
Hopefully this action won't come back to bite me somehow in the future.
I don't want anything in /usr/local on my system so there's no point
in looking there first thing every time.
Annoyance solved.
Thanks for the replies.
Last edited by Terry Coats; 04-30-2017 at 01:32 PM.
Reason: typo
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.