Path settings

Polytropon freebsd at
Wed Apr 8 16:35:07 UTC 2015

On Wed, 8 Apr 2015 08:04:10 -0400, Jerry wrote:
> I have never understood which comes first in the path setting; "/usr/bin"
> or "/usr/local/bin". The same can be said for "/usr/sbin"
> and /usr/local/sbin".

System-level tools usually have higher priority, and
additionally installed software (which resides in /usr/local
subtrees per default).

Per-user installed software, as well as software not
managed by ports or pgk, can be put into ~/bin or /opt/bin,
but this typically requires additions to the configuration.

> The reason I am asking is because I have "openssl" installed from ports. If I
> have the former path setting and run "which openssl", the system openssl is
> reported. However, if I switch the path setting to the latter, and rerun the
> command, the port version of openssl is revealed.

This behaviour is logical and intended. Just imagine someone
would install a "ls 'replica'" which would do stupid or
nasty things... ;-)

The _first_ matching command found by looking at the $PATH
entries will be executed.

However, it's probably easier to get rid of the system's
OpenSSL tools if you're not intending to use them. Keep
in mind that certain scripts may redifine $PATH, so what
you expect in a user's CLI session might not apply when
you run scripts (or when the system runs them).

> I have "WITH_OPENSSL_PORT=yes" in the "/etc/make.conf" file if that makes any
> difference.

in /etc/src.conf to _not_ have them in the system, and
you will have to supply them as ports. ALso check the
ports options, it's possible that there's a configuration
switch (in "make config") that allows the port to install
files to the system-level directories (such as CUPS can
do, to replace the system's lp* tools).

See "man src.conf" for details.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list