# bash: command not found

**Code:** `command not found` · **Category:** Linux · **Seen on:** Linux, Windows

The shell can’t find an executable with that name in any directory on your PATH.

## Meaning

Either the program isn’t installed, it’s installed in a directory not on PATH, or there’s a typo. Scripts run by cron/systemd often have a minimal PATH.

## Common causes

- Program not installed
- Installed to a directory not on PATH (`~/.local/bin`, `~/.npm-global/bin`)
- Typo
- Cron/systemd minimal PATH
- Windows line endings in a script (`/bin/bash^M: bad interpreter`)

## Quick fix

1. Install the package (`apt install`, `brew install`)
2. Add the directory to PATH in ~/.bashrc / ~/.zshrc
3. Use absolute paths in cron
4. Convert line endings: `dos2unix script.sh`

## Detailed fix by platform

### Linux

1. `type -a <cmd>` / `which <cmd>` show what the shell resolves; `echo $PATH` shows where it looks.

## How to diagnose

1. **Installed** — Is the package installed?
2. **PATH** — Is its directory on PATH in this context?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/linux/command-not-found)
