I've read in a couple of places that the PATH
is set in /etc/profile
or the .profile
file that's in the home dir.
Are these the only places that the path is set in? I want a better understanding of it.
In the /etc/profile
file, as the following comment says "system-wide .profile file for the Bourne shell"
. Does that mean that profile files are the main configuration files for bash?
In that file I don't see the PATH
var being set at all. In the .profile
file in the home directory there's this line:
PATH="$HOME/bin:$PATH"
That's resetting PATH
by the looks because it's concatenating the already set $PATH
string with $HOME/bin:
right? But if etc/profile
and ~/.profile
are the only files setting PATH
where is $PATH
coming from in that line of code if it's not defined in /etc/profile
?
Can someone experienced please give a broad and detailed explanation of the PATH
variable? Thanks!
indeed, finding out where some part is defined requires too much effort.
Thus, I’ve codified the heuristics into a tool:
https://github.com/d-led/pathdebug
– Dmitry Ledentsov Jan 04 '24 at 18:10pathdebug PATH
and you'll get the sources, and whether the directories exist or are duplicates