Linux / UNIX: Command Not Found Error and Solution

Linux / UNIX: Command Not Found Error and Solution

The "command not found" error in Linux or Unix occurs when you try to run a command that is not recognized by the system. This can happen for a number of reasons, including:

  • The command is spelled incorrectly
  • The command is not installed on the system
  • The command is not in your PATH

To solve the "command not found" error, you can try the following steps:

  1. Check the spelling of the command. Make sure that you have typed the command correctly, including any options or arguments.

  2. Make sure that the command is installed on your system. If the command is not a built-in shell command, it may need to be installed from a package manager or downloaded from the internet.

  3. Check your PATH environment variable. The PATH variable specifies the directories that the shell should search for commands. If the command is not in one of these directories, the shell will not be able to find it. You can check your PATH variable by typing the following command at the command prompt:

echo $PATH
Source:w‮ww‬.lautturi.com

This will display a list of directories separated by colons. If the directory that contains the command is not in this list, you can add it by modifying the PATH variable in your shell configuration file (such as .bashrc, .bash_profile, or .zshrc).

For example, to add the /usr/local/bin directory to your PATH, you can add the following line to your shell configuration file:

export PATH=$PATH:/usr/local/bin

You will need to log out and log back in for the changes to take effect.

If you are still having trouble resolving the "command not found" error after trying these steps, you may need to seek assistance from a qualified Linux or Unix administrator.

Created Time:2017-10-29 22:08:56  Author:lautturi