← Back to Error Index
root@linuxfix:~/bash_command_not_found$
bash command not found
Command not found error in bash

Solutions

Prerequisites: Start by updating your system to resolve common issues and ensure the solutions provided below are compatible with your current environment.
check_latest_version && sudo apt update && sudo apt upgrade -y
Check command spelling

Verify the command name is correct:

which command_name
type command_name
whereis command_name
Install missing package

Install the package containing the command:

sudo apt install package_name
sudo yum install package_name
command-not-found command_name
Check PATH variable

Verify command location is in PATH:

echo $PATH
export PATH=$PATH:/new/directory
hash -r

What is bash command not found?

This error occurs when bash cannot locate the specified command in the system PATH or the command doesn't exist.

Common scenarios: Typos in command names, missing packages, incorrect PATH, or trying to run non-executable files.

Common Causes

  • Command name misspelled
  • Package not installed
  • Command not in PATH
  • Missing execute permissions
  • Wrong shell or environment

Debugging Tips

echo $SHELL
ls -la /usr/bin/command
find /usr -name command_name
dpkg -S command_name

Prevention

  • Use full paths for scripts
  • Verify package installation
  • Check spelling before running
  • Update PATH in shell profiles
shell bash command path