Quick Fix: zsh Command Not Found

Are you facing any issues with the zsh command in Linux? Sometimes when you are z Shell instead of bash you may get errors related to zsh. In this post, I will tell you how to quickly fix zsh command not found error.

Quick Fix: zsh Command Not Found

As you can see in the figure on the right. While you are using the z Shell upon using the ls command it is throwing an error that command not found: ls.

This error is mostly encountered by MacOS users. There can be various reasons for this error to occur but I will discuss that once I tell you the fix first.

How to Fix zsh Command Not Found

This error usually occurs when you mess up the PATH variables of your computer. PATH variable in your computer is the location you need to mention of the tools and software you want to access from any drive or folder of your device in command prompt or terminal.

You can use the below commands to get your PATH variable updated for the zsh command not found error fix.

export PATH
export PATH=~/usr/bin:/bin:/usr/sbin:/sbin:$PATH

You need to add the above code in the .zshrc file (This file will be present in the home directory of your computer). Edit that file using any text editor and then remove any PATH-related information in the header and add the above line in that file and save it.

Also, note that the .zshrc file is a hidden file by default. Hence you should unhide it first or keep your hidden files settings as visible.

Alternatively, you can press the command + shift + “.” button to get the hidden file visible. And then you can update the file as directed above.

Reasons for zsh Command Not Found Errors

As we already discussed in this post that because of the path variable you can encounter this problem on your computer. But there are other reasons as well that are as follows.

  1. The PATH variable is incorrect or missing.
  2. Incorrect Command Syntax.
  3. Command or Syntax you are trying to run is not installed. For Example, you want to run python and when you will enter python you will get the error. This is because either python PATH variables are not set correctly or Python is not installed on your system.

All these problems can easily be fixed and resolved by just installing the required software or by setting up the correct PATH variable of the software you are trying to access from the command prompt or terminal.

And if you are trying to fix the wrong syntax error then in that case you need to learn the bash command not to encounter this error again. Try using Google for the command you are getting errors for and see if you are using the command correctly in the Terminal.


The above step guide you to fix the zsh command not found an error in your terminal. Also, you get to know the various reasons why this error can occur and what steps you can take to resolve those issues as well.

You learned how to fix PATH variable errors if it is incorrectly configured in your computer.

If you are still not able to fix this error or problem. Please provide your comment below and I will be happy to help you as soon as possible.

If you liked our post related to quickly fix this issue then please follow us on Facebook and Twitter. Let us know the questions and answer you want to cover in this blog.

If you wanna check more Python-related posts then Read Prime Generator in Python.

Leave a Comment