Command not found in Bash: a safe checklist
Updated August 29, 2026
A command not found message means the shell could not find an executable with that name. It does not necessarily mean the program is broken.
Check the name and PATH
command -v tool-name
printf '%s\n' "$PATH"
Use the command's documented spelling, including hyphens and capitalisation. If command -v prints nothing, check whether the package is installed and whether its bin directory is in PATH. After changing a shell profile, start a new terminal or reload the relevant file:
source ~/.zshrc # zsh
source ~/.bashrc # bash
Do not add random directories from internet snippets to PATH. Prefer the installer or package manager's documented shell setup, and inspect a command before running it with type -a tool-name.
When only sudo fails
sudo can use a different, restricted PATH. A program that works as your user may not be available to root. Fix the installation or use the full path rather than copying a user-specific shell configuration into /root.
If the command is supplied by a project, activate its virtual environment or use the project's wrapper (./mvnw, npx, or python -m ...) instead of installing a second global copy.
Sources
related.
Ruslan Osipov
About the author