Conventions for the PATH variable's value
0
votes
1
answer
255
views
I am looking for best practices, or at least conventions, for the
PATH
variable's value.
In particular, I would like to know
1. is there any preferred/recommended ordering for the /bin
, /usr/bin
, and /usr/local/bin
directories in the value of PATH
?
2. are there any downsides to including /sbin
, /usr/sbin
, and/or /usr/local/sbin
in a non-root user's PATH
variable?
Regarding (1), my uninformed opinion is that these paths should appear in the order
..:/usr/local/bin:...:/usr/bin:...:/bin:...
...in the PATH
variable. The thinking here (to the extent there is any) is that /usr/local/bin
may be where a local installation would put a "local" override of a command that may also exist under /usr/bin
. By the same token (and now really stretching it!), /usr/bin
may contain distro-/vendor-level overrides to commands that traditionally live under /bin
.
I realize that the above is 99% fantasy. That's why I am asking this question.
In a similarly hallucinatory vein, I seem to recall the notion that the commands in */sbin
directories are meant for folks with superuser privileges, and it would confuse the regular users' little brains to make these commands available to them. In other words, the PATH
variable for regular users should not include any */sbin
paths.
Be that as it may, I don't recall ever coming across a system that included */sbin
paths in the initial setting of the PATH
variable (by this I mean the setting of PATH
that each user gets before his/her shell initialization scripts are run), and I wonder why this is so.
Asked by kjo
(16299 rep)
Feb 22, 2023, 08:27 PM
Last activity: Feb 22, 2023, 09:14 PM
Last activity: Feb 22, 2023, 09:14 PM