zsh: command not found

Okay, so I bet that you considered installing zsh. Why would you not? It’s a pretty cool shell – especially if you pair it with Oh My Zsh – which adds so many cool features such as themes and plugins! That’s exactly why I started using it.

However, if you follow the Debian documentation on zsh without paying too much attention you might encounter certain issues running some programs after making the switch to zsh.

For example, whenever I ran dmidecodein zsh, I would get a command not found. Ok, so maybe dmidecodeis not installed in Debian 12 by default?

sudo apt install dmidecode

Reading package lists… Done

Building dependency tree… Done

Reading state information… Done

dmidecode is already the newest version (3.4-1).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

No, it is installed. Let’s check further:

whatis dmidecode

dmidecode (8) – DMI table decoder

So it is installed and the system recognizes it as a valid program. Could the issue be that zsh cannot access those binaries? I wonder where the dmidecodebinaries are located:

which dmidecode

/sbin/dmidecode

Let’s see how the PATHis set up in the zsh configuration file ~/.zshrc:

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

Got it! So zsh could not find those binaries as their directories were not added to the PATH – which by the way the Debian documentation on zsh does not highlight as needed.

After changing the PATH in my zsh config file ~/.zshrc to the one below and reloading the zsh configuration, now it’s all working!

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

source ~/.zshrc

Done!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.