LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 04-30-2017, 01:33 AM   #1
Terry Coats
Member
 
Registered: Mar 2017
Posts: 122

Rep: Reputation: 54
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.
 
Old 04-30-2017, 02:58 AM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
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
 
Old 04-30-2017, 03:15 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
"pathprepend $HOME/bin" does it. Change that instruction into "pathappend".
 
Old 04-30-2017, 04:29 AM   #4
Terry Coats
Member
 
Registered: Mar 2017
Posts: 122

Original Poster
Rep: Reputation: 54
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.
 
Old 04-30-2017, 04:37 AM   #5
Terry Coats
Member
 
Registered: Mar 2017
Posts: 122

Original Poster
Rep: Reputation: 54
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.
 
Old 04-30-2017, 05:46 AM   #6
Terry Coats
Member
 
Registered: Mar 2017
Posts: 122

Original Poster
Rep: Reputation: 54
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /usr/local/bin in #PATH, yet command of program there does not work mark_alfred Ubuntu 3 04-28-2017 12:30 PM
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 08:33 AM
path in services wrong for clamav updated frm 0.75 to 0.80 usr/bin vs usr/local/bin Emmanuel_uk Linux - Newbie 3 04-22-2005 01:02 AM
Can't move program files to /usr/local/bin/ asburyguy Linux - Newbie 4 04-03-2004 11:53 AM
/usr/local/kde/bin in PATH aeshley Linux - Newbie 2 05-23-2002 04:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 08:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration