PATH
Standard
The standard Ubuntu PATH for interactive usage, in most cases is:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
The above is preferred hardcoded PATH for kernel, libc, shells, and similar use cases. For example, this is the built-in path that should be used by /bin/sh, if PATH is not already set in the environment.
Standard snap-less
If snapd is not installed on a classic system; container; chroot; the PATH can also be snap-less as typically snapd is responsible for appending /snap/bin:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
System managed non-interactive
System built-ins, daemons, system utilities, and upgrade scripts may use local-less PATH (optionally snap-less too):
PATH="/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
This is to ensure that binaries in /usr/local do not hinder apt upgrades (including deb2snap conversions).
Examples of system-managed software: initramfs-tools, dracut, finalrd, dpkg maintainer script, do-release-upgrade, subiquity, curtin, d-i.
No Games
The games path is deprecated and should be removed from PATH. For reference, it used to look like this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
No Reordering
Reordering PATH components is not allowed - real location lead, symlinked locations follow; then sbin leads, and bin follows.
If sbin-merge is implemented, ensure that /usr/bin (real directory) is ahead of /usr/sbin (symlink). As of April 2025, there are no current plans to implement sbin-merge in Debian/Ubuntu.
No ~/bin
Logged-in user's path should not be automatically mangled to inject ~/bin, or ~/.local/bin or similar variants of thereof.
No PWD
Present working directory is not in PATH. Neither :: nor :.: should be in PATH, both of these values mean present working directory.
No changes with usr-merge
/bin and sbin will not be dropped from PATH in case of a usr-merged system. (Or vice vera /usr/[s]bin will not be dropped either).
PATH (last edited 2025-04-13 14:28:06 by xnox)