Linux CMD_NFMedium

Error 'command not found' in Linux: causes and solutions

The 'command not found' error occurs when the system cannot find the executable file for the command. This usually happens due to a missing package, incorrect PATH, or a typo in the command name.

Updated at February 13, 2026
15-45 min
Easy
FixPedia Team
Применимо к:UbuntuDebianCentOSFedora

Error "command not found" in Linux

The error "bash: command not found: command" (or "zsh: command not found: command" in Zsh) is one of the most common issues in the Linux terminal. It means that the shell could not find the executable file for the specified command in the system paths.

Causes of the Error

There are several main reasons for the command not found error:

  1. Command not installed — the required package is simply not installed on the system
  2. Incorrect PATH — the directory with the command is not added to the PATH environment variable
  3. Typo in the name — the command was entered incorrectly or with the wrong case
  4. Lack of execution permissions — the file exists but does not have the executable attribute

Diagnosing the Error

1. Check for Typos

# Example of a typo
$ pyton --version
bash: pyton: command not found

# Correct version
$ python3 --version
Python 3.10.12

2. Check the PATH Variable

echo $PATH

Typical output:

/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

If the required directory is missing, add it:

# Temporary addition (valid until the terminal is closed)
export PATH=$PATH:/usr/local/myprogram/bin

# Permanent addition (for the current user)
echo 'export PATH=$PATH:/usr/local/myprogram/bin' >> ~/.bashrc
source ~/.bashrc

3. Find the Command's Location

# Search for the command in PATH
which python3
# Output: /usr/bin/python3

# Find all files related to the command
whereis python3
# Output: python3: /usr/bin/python3 /usr/bin/python3.10

# Show the type of command (builtin, alias, function)
type python3

4. Check if the Package is Installed

# For Debian/Ubuntu
dpkg -l | grep <package_name>
apt list --installed | grep <package_name>

# For CentOS/Fedora/RHEL
rpm -qa | grep <package_name>
dnf list installed | grep <package_name>

Solutions

Installing Missing Commands

Ubuntu/Debian

sudo apt update
sudo apt install <package_name>

# Example: installing curl
sudo apt install curl

CentOS/RHEL

sudo yum install <package_name>
# or
sudo dnf install <package_name>

Arch Linux

sudo pacman -S <package_name>

Common Commands

CommandPackage (Debian/Ubuntu)Package (CentOS)
curlcurlcurl
wgetwgetwget
gitgitgit
nanonanonano
vimvimvim
python3python3python3

Prevention

  1. Regularly update the system — this ensures that you have the latest versions of packages
  2. Use autocompletion — press Tab for automatic command completion
  3. Check the documentation — review dependencies before installing new software
  4. Create aliases — for frequently used commands with long paths

Conclusion

The command not found error is rarely a serious problem and is usually easily resolved by installing the appropriate package or correcting the PATH variable. By following the diagnostic steps outlined above, you can quickly identify and resolve the cause of the error.

If the problem persists after following all recommendations, check the system logs or consult the documentation for your specific Linux distribution.

F.A.Q.

Why does the command work as root but not as a regular user?
How to find where the program is installed?
The command was there yesterday, but not today — what could have changed?

Hints

Check the spelling of the command
Check the PATH variable
Install the missing package
Find the location of the command
FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community