Skip to content

Fix Command Not Found on Linux: A Beginner Guide

Admin
November 18, 2026
5 min read
Beginner
💻 Target OS: Ubuntu 26.04 LTS / RHEL 10

Before you begin

  • Applies to:Ubuntu 26.04 LTS and Red Hat Enterprise Linux (RHEL) 10. Use the package query for your distribution in Step 2.
  • Where to start:Use the Bash terminal where the error appeared, under your regular account.
  • What you need:Copy the exact command name from the error. Step 1 uses git as an example.
Guide tools
Guide tools
0/0 Steps (0%)

Troubleshooting Steps

01

Check the spelling and Bash lookup

Start here

In the Bash shell where the error appeared, set tool to the exact command name. Keep this shell open for Step 3. It prints a path or identifies a shell command if Bash can find it. If it prints nothing, check the spelling, then inspect PATH. PATH is the colon-separated list of directories Bash searches for executable files.

What you should see · A path or shell command appears for the exact name you entered.

If you see something else · If a path appears, use Step 3 to verify that it is the intended program. If nothing appears, go to Step 2 to check the package or the script’s location.

Terminal window
tool=git
command -v "$tool"
printf '%s\n' "$PATH"
02

Check the package or use an explicit path

Narrow the cause

Run only the package query for your distribution. Replace git with the package name that provides your command, which can differ from the command name. On Ubuntu, look for the status install ok installed. A status ending in config-files means the package was removed and residual configuration remains. On RHEL, rpm -q reports whether the package is installed. If the package is absent, confirm the official package name before installing via your system’s package manager. If your tool is a script in the current folder, use its explicit path, such as ./tool, after checking its origin and permissions. For an installed program missing from PATH, confirm its actual directory before editing any shell startup files.

Terminal window
# Ubuntu
dpkg-query -W -f='${Status} ${Package}\n' git
# RHEL
rpm -q git
03

Verify in the same shell

Verify

After the approved installation or path correction, repeat command -v. Check that its result points to the expected location, then run the version command for a trusted program. If the tool works in a new terminal only, check how the current shell was started and whether it loaded the same configuration.

Terminal window
command -v "$tool"
# For a trusted tool that supports --version:
"$tool" --version

Reference

Comments