command not found

Linux SystemCLI ErrorCommonLast updated: June 29, 2026Tested on:Ubuntu 22.04 LTSBash Shell v5.1June 2026

This error occurs when the shell cannot find the executable binary matching the command name in your system's PATH directories.

command not found Quick Fix⏱️ Est. Fix Time: 2 minutes

Usually happens because:

  • The program package is not installed on the server
  • Program bin directory is not listed in active $PATH
  • Spelling typo inside command invocation

🔍 Quick Checklist:

What is command not found?

When you type a command in the terminal, the shell (such as bash or zsh) looks through a list of directories specified in the $PATH environment variable to locate the matching executable binary file. If the binary is not installed, the folder is missing from the $PATH list, or the command name has a spelling typo, the shell returns 'command not found'.

Common Causes

  • Binary program not installed: The software package hosting the executable is not installed on the system.
  • Missing path in $PATH variable: The program is installed, but its directory is not listed inside your environment's $PATH variable (common for custom scripts or user installations).
  • Spelling typo in command name: Typing errors in command invocation.
CauseFrequency
Target binary package not installed on system⭐⭐⭐⭐⭐
Directory not added to environment $PATH variable⭐⭐⭐⭐
Spelling typo in command name⭐⭐⭐

Common Mistakes

  • Forgetting to run `source ~/.bashrc` or restart the terminal window after updating your PATH variable, which leaves the old PATH profile active.
  • Typing a command inside a new shell that does not support it (e.g. using `ll` command in environments that lack an alias mapping for `ls -la`).

How to Fix

1Install the package: Install the program using your system package manager (e.g. 'sudo apt install <package>').
2Add directory to PATH: Update your PATH variable in your shell profile configuration file (e.g. ~/.bashrc or ~/.zshrc).
3Verify spelling and path: Double check the spelling or run the executable directly using its absolute path (e.g. '/usr/local/bin/mycmd').

Linux Operations & Verification

Append custom bin directories to your user's shell configuration variables profile to enable global access.

Adding directories to PATH Example
# 1. Append target export to shell configuration
$ echo 'export PATH="$PATH:/usr/local/bin/custom"' >> ~/.bashrc

# 2. Reload shell configuration properties
$ source ~/.bashrc

# 3. Test command execution

Platform Specific Fixes

Install target package using standard Debian utility helper apt.

Linux (Ubuntu/Debian) Config
sudo apt update
sudo apt install git -y

Best Practices

  • Verify binary availability using the `which` or `type` command (e.g. `which git` will print the path if installed).
  • Document application binary dependencies inside project README files.

Frequently Asked Questions (FAQ)

Q: What is the PATH variable?

The PATH variable is a colon-separated list of directories ($PATH) that the shell searches when you execute a command.

Q: How do I print my active PATH?

Run 'echo $PATH' in your shell to inspect all search directories.

Q: Why does it fail on script executions inside my current directory?

For security reasons, Linux shells do not search the current directory (.) by default. To run a script in the active directory, prepend './' (e.g. './myscript.sh').

Q: How do I permanently add a folder to my PATH?

Add 'export PATH="$PATH:/path/to/folder"' to your ~/.bashrc or ~/.zshrc file, then run 'source ~/.bashrc' to reload.

Still having this problem?

Didn't solve your problem?

SuggestRequest Error