How to Fix “Zsh command not found” Error in Linux

Linux operating systems make great use of command line terminals and shells. Some of them are inbuilt into the operating systems whereas some of them are manually installed onto the system. The “zsh” or Z shell is the best example of this statement. This shell compared to the standard terminal, provides a much better. While attempting to utilize this tool, an error with the statement “Zsh command not found” may occur.

This article will elaborate on the reasoning behind this error and also demonstrate to you how this error can be solved.

How to Resolve the “zsh command not found”?

There are different reasons that can invoke this issue. This section will tackle all possible causes and also elaborate on how they can be resolved. The error statement should look something like the one shown below:

Reason 1: The zsh is not Installed

The first possible reason is the most obvious one especially when it comes to the “command not found” problems. The reason is that the zsh is not installed on your system. When this happens, running the zsh command on the terminal will lead to this error. Let’s take look at how this issue can be resolved.

Solution: Install the zsh

how to handle linux files and direc...

The solution to not having “zsh” installed on your system is very obvious. This is to install the zsh to your system. To achieve this, execute the command that is shown below:

$ sudo apt install zsh

The installation is displayed in the snippet below:

Reason 2: Invalid Command

Another major reason for this error can be that the command that is entered into the zsh is not invalid. This means that the command does not exist in the zsh library. Let’s take an example below:

The command below is shown to be running the “cls” command. But in Linux, no such command exists for clearing the screen. Due to cls being an invalid command, the error is prompted.

Solution: Use Valid Commands

To avoid this error, it is imperative that the correct commands must be used. If we take the example above, the correct command for clearing the screen in Linux would be the “clear” command. Using that command will remove the error.

Reason 3: Package not installed

The zsh command not found can also be invoked when the package that is being attempted to run using the zsh terminal is not installed on the system. Check out the snippet shown below:

In this case, the pip package is not installed, hence the error is shown to the user.

Solution: Install the Package

To resolve this issue, the solution is very simple. The missing package needs to be installed using the zsh. Check out the snippet below as an example:

$ sudo apt install npm


The “zsh command not found” problem occurs due to 3 major reasons. The first is that the zsh package is not installed. The second is that the command being run on the z shell is not valid. The third is that the package which is run on the z shell is not installed. To resolve these issues, the zsh or the required package needs to be installed or it needs to be made sure that the command in use is valid. This post has listed the reasons and the possible solutions to those reasons are also provided.