AI Diagnostic Summary

Linux 'command not found': Install the Package or Fix PATH

Well-Documented Error

This error matches known, documented patterns with reliable solutions.

Quick Fix (Most Common Solution)

Seeing "command not found"? This error can be frustrating, but it's usually fixable. It typically affects your development workflow or system. Below you'll find clear, step-by-step solutions to resolve this issue.

High confidence
What This Error Means

The shell searched all directories in the PATH environment variable and could not find an executable with that name. Either the package containing the command is not installed, or the binary is in a directory that is not in PATH.

Frequently documented in developer and vendor support forums.

Based on documented solutions and common real-world fixes.
Not affiliated with browser, OS, or device manufacturers.

New here? Learn why exact error messages matter →

Common Causes
  • Package is not installed on this system
  • Binary is installed but its parent directory is not listed in PATH
  • Command name differs between distributions (e.g. python vs python3, vi vs vim)
How to Fix
  1. Try installing the command directly by its name (works for many common tools)
  2. If the package name is unknown, search the package manager for the keyword
  3. If installed but not found, use which to locate the binary and fix PATH
  4. Add the binary directory to PATH permanently in your shell profile

Last reviewed: June 2026 How we review solutions

Didn't fix it? Get a personalised solution

Works with any error — screenshots, terminal output, or device displays

or paste text
Environment-Specific Commands

Debian / Ubuntu — apt

  1. sudo apt update
  2. sudo apt install [command-name]
  3. [command-name] --version

RHEL / CentOS / Fedora — dnf

  1. sudo dnf install [command-name]
  2. [command-name] --version

Fix PATH — add directory permanently

  1. which [command]
  2. echo 'export PATH="$PATH:/path/to/directory"' >> ~/.bashrc
  3. source ~/.bashrc
  4. [command-name] --version
Quick Diagnostic Path
  • If which [command] returns a path but shell still says not found Open a new terminal — the PATH change may not have been loaded in the current session
  • If Command works as root but not as your user The binary is in /sbin or /usr/sbin which is in root's PATH but not the user PATH. Add /usr/sbin to your PATH.
  • If Command exists on another machine but not this one Check the distro-specific package name: apt-cache search [keyword] or dnf search [keyword]
If This Still Fails, Check
  • snap/flatpak installs use different paths not in default PATH — check with 'snap list' or 'flatpak list' if the command was installed that way
  • Python on Ubuntu 20.04+: 'python' is not installed by default, only 'python3'. Install the alias: sudo apt install python-is-python3
  • Scripts with #!/usr/bin/env python shebang will fail if only python3 is installed. Update the shebang line to #!/usr/bin/env python3
Diagnose and fix command not found
# Step 1: check if the binary exists anywhere
which [command]
find /usr /usr/local /opt -name "[command]" 2>/dev/null

# Step 2: install it (Ubuntu/Debian)
sudo apt update && sudo apt install [command]

# Step 3: if found but PATH is wrong
echo 'export PATH="$PATH:/path/to/bin"' >> ~/.bashrc
source ~/.bashrc

# Step 4: verify
which [command]
[command] --version

OS-Specific Behavior

Command Not Found Differences Across Ubuntu, CentOS, Alpine, and Debian

Command Not Found behavior varies significantly across Linux distributions because package names, default configurations, filesystem layouts, and init systems differ between distros. A fix that works on Ubuntu may fail on CentOS or Alpine. Package name differences are the most common trap: the OpenSSL development library is libssl-dev on Debian/Ubuntu but openssl-devel on RHEL/CentOS. Python 3 is python3 on Debian/Ubuntu but may be python3.x on older RHEL. Alpine Linux uses musl libc instead of glibc, which causes binary compatibility issues with pre-compiled binaries and Python native extensions that assume glibc. Init system differences: Ubuntu 16.04+ uses systemd, older CentOS uses SysVinit, Alpine uses OpenRC — systemctl commands fail on Alpine. When documenting fixes, always specify which distribution and version the fix was tested on. Use cat /etc/os-release to identify the exact distro and version before applying fixes from Stack Overflow or documentation.

Optional follow-up

Some users ask whether saving fixes for recurring errors would be useful when the same issue appears again.

Was this explanation helpful?

Explanations are based on documented fixes, real-world reports, and common system behavior. GetErrorHelp is independent and not affiliated with software vendors, device manufacturers, or service providers.
Frequently Asked Questions

How do I find the correct package name for a command?

On Debian/Ubuntu: 'apt-cache search [keyword]'. On RHEL/Fedora: 'dnf provides [command]'. The apt-file tool also maps command names to packages: apt-file search [command].

I installed the package but the command is still not found

The binary may be in /usr/local/bin or another directory not in PATH. Run 'find /usr /opt -name [command] 2>/dev/null' to locate it, then add that directory to PATH.

What is PATH and how do I check it?

PATH is a colon-separated list of directories the shell searches for executables. Run 'echo $PATH' to see it. Run 'which [command]' to see which PATH directory contains a command.

Related Resources

Also Known As

Common Search Variations

Related Errors
Still Stuck?

Paste a different error message or upload a screenshot to get help instantly.

Solutions are based on commonly documented fixes and may not apply in all situations.