"Command Not Found": Fixing Your PATH

You installed the tool, but the shell insists it doesn't exist. Nine times out of ten it's a PATH problem — here's how to confirm it and fix it.

BytExplorer 5 min read June 28, 2026

You install a tool, type its name, and the shell snaps back command not found. The program is right there — so what's going on? Almost always, your PATH is the culprit.

What PATH actually is

When you type a command, the shell doesn't search your whole disk. It looks only in the directories listed in the PATH environment variable. If the program lives somewhere not on that list, the shell genuinely can't find it — hence "not found."

See your current PATH:

echo $PATH

That's a colon-separated list of the only folders the shell will search.

Step 1: Confirm where the tool is

Find out if the program exists and where:

which toolname        # prints its path if it's on PATH
find / -name toolname 2>/dev/null   # locate it anywhere

If which prints nothing but find locates it, you've confirmed a PATH problem: it exists, just not in a searched directory.

Step 2: Add its directory to PATH

Say the tool lives in /opt/mytool/bin. Add that directory:

export PATH="$PATH:/opt/mytool/bin"

Test the command again. If it now works, the diagnosis was right.

Step 3: Make it stick

That export only lasts for the current terminal. To make it permanent, add the same line to your shell's startup file (commonly ~/.bashrc or ~/.zshrc), then reload it:

source ~/.bashrc

A new terminal forgetting your fix is the classic sign you set PATH for the session but never saved it to your shell config.

The takeaway

"Command not found" rarely means the program is missing — it means the shell wasn't told where to look. Check PATH, confirm with which/find, add the right directory, and persist it in your shell config.

Put it into practice

Stop reading, start building

This pairs with a hands-on BytExplorer course — do it on your own machine and actually keep the skill.

More in Troubleshooting