bash: command not found means Bash could not resolve the name you entered to a command it can run. Check the spelling and the current shell, then determine whether the program is installed and whether its directory is on PATH. For a script in the current folder, use an explicit path such as ./hello.sh.

Find out what Bash can see

Replace python3 below with the command that failed:

command -v python3
type -a python3
printf '%s\n' "$PATH"

command -v shows the command Bash would select, when it finds one. type -a helps reveal multiple matches, including functions, aliases and executable files. PATH is a colon-separated list of directories used when searching for an external command by its name.

If a path is returned but running the command still fails, read the new error. A missing interpreter or broken executable is different from Bash being unable to find a command name. Our permission-denied guide covers the case where access or execution is rejected.

A file in the current folder is not automatically a command

Save this as hello.sh in a new test folder:

#!/bin/bash
printf "%s\n" "Hello from Linux"

Then run:

chmod u+x ./hello.sh
./hello.sh

This produced Hello from Linux in the Ubuntu test. Running only hello.sh with PATH set to /usr/bin:/bin returned command not found and exit status 127, even though the same file existed. The ./ tells Bash exactly where to look.

Use cd to reach the intended directory before invoking a relative path. Do not paste a shell prompt's $ or # marker as part of a command.

If the program is not installed

Check the software's official installation instructions for your Linux distribution and version. The executable name and package name are not always identical. For example, Ubuntu's SSH server package is openssh-server, while the server executable is sshd; the SSH setup guide explains the client/server distinction.

On Ubuntu or Debian, a package search can help identify the package name:

apt-cache search openssh-server

Search results show available package descriptions, not proof that a package is installed. Avoid installing an unrelated similarly named package merely because a shell suggestion offers it.

If the program is installed outside PATH

First run it by the full path documented by its installer. To understand a PATH change without modifying your startup files, this test temporarily adds the current test folder inside a subshell:

(
  export PATH="$PWD:$PATH"
  command -v hello.sh
  hello.sh
)

The test prints the script's path and its greeting. The parentheses keep the PATH change inside that subshell. Only do this in your trusted test folder: placing a writable or untrusted directory early in PATH can cause its programs to override other commands.

For an actual installed tool, follow the vendor's instructions for adding its specific directory to the relevant shell startup file. A terminal, a scheduled task and a service may use different environments. If you have moved an executable while keeping the same Bash session open, hash -r clears Bash's remembered executable locations.

Check that you are in the intended environment

A command available in Ubuntu is not necessarily installed in Windows PowerShell, Git Bash, a container or another WSL distribution. Launch the intended Ubuntu distribution from PowerShell before following Linux instructions. Conversely, systemctl needs an appropriate Linux environment; use the systemctl-specific diagnostic guide rather than trying to install it in every shell.

When asking for help, provide the exact command, exact error, distribution/version and whether this is a normal terminal, WSL, a container or a scheduled task. Redact private paths and credentials.

Sources and verification

Tested September 11, 2026 in a disposable Ubuntu 24.04 container: a missing name returned 127, explicit ./ invocation succeeded, and a subshell PATH extension found the test script. No user startup file was changed. Software-specific installation problems are outside this test.

If installing the missing tool fails

An APT package lookup error needs different checks from Bash command lookup. If the publisher provides a local package, follow the Ubuntu .deb installation guide.