Error Codes Wiki

Linux Exit Code 127 — Command Not Found

Warningcommand

About Linux Exit Code 127

Linux exit code 127 means the command could not be found in the system PATH or is not installed. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: bash: command: command not found. Shell searched all PATH directories without finding the command. The program may not be installed. PATH variable may be misconfigured. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: Program is not installed on the system. Program not in any directory listed in $PATH. Typo in the command name. Shell profile not loaded (non-login shell). Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: Check if installed: which commandname or type commandname. Install the package: apt install packagename or yum install packagename. Check PATH: echo $PATH. Use full path: /usr/local/bin/commandname. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our Linux Error Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

How do I find which package provides a command?

Debian/Ubuntu: apt-file search commandname. RHEL/Fedora: dnf provides commandname.

Overview

Linux exit code 127 means the command could not be found in the system PATH or is not installed.

Key Details

  • bash: command: command not found
  • Shell searched all PATH directories without finding the command
  • The program may not be installed
  • PATH variable may be misconfigured

Common Causes

  • Program is not installed on the system
  • Program not in any directory listed in $PATH
  • Typo in the command name
  • Shell profile not loaded (non-login shell)

Steps

  1. 1Check if installed: which commandname or type commandname
  2. 2Install the package: apt install packagename or yum install packagename
  3. 3Check PATH: echo $PATH
  4. 4Use full path: /usr/local/bin/commandname

Tags

linuxcommandexit code 127troubleshootingfix

More in Command

Frequently Asked Questions

Debian/Ubuntu: apt-file search commandname. RHEL/Fedora: dnf provides commandname.