Consider, academically, that I have executed
sudo mv /bin /foo. I didn't stop to ask questions, I took charge of my destiny and did it.
What would I have to do if I wanted to permanently change the system-wide
$PATH to reflect this change? This includes:
- interactive shells
- non-interactive shells
- GUI logins
- system services
- sudo use
The reason I ask this, is the water is very muddy about the correct way to do this. Answers to this question variously suggest:
~/.bashrc(won't affect e.g.
~/.profile(only affects login shells)
/etc/environment(doesn't affect sudo; sometimes PATH doesn't seem to be here?)
Are there other core system utilities which are likely to cause problems by trying to use some
$PATH copy defined in yet other ways or places that I haven't covered here? How do you override
$PATH when using sudo?
Where does the One
$PATH To Rule Them All live, and how do I add
/foo to it?
I know this has been asked a bunch of times but there are so many different questions and answers floating around and many of them are out of date or cover only certain cases.
PATHpermanently and systemwide; however
sudois configured to use its own
secure_pathwhich is unaffected by the