Fix Ubuntu /bin/sh: 1: zsh: not found error


If you try to move to zsh shell on Ubuntu terminal and you get error /bin/sh: 1: zsh: not found error, then the most common reason will be that you do not have zsh shell installed on your device.

If you will go under /bin folder, you will not find zsh

How to install Zsh on Ubuntu?

Run command: sudo apt install zsh to install zsh

# sudo apt install zsh
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libcap2 libgdbm6 zsh-common
Suggested packages:
  gdbm-l10n zsh-doc
The following NEW packages will be installed:
  libcap2 libgdbm6 zsh zsh-common
0 upgraded, 4 newly installed, 0 to remove and 15 not upgraded.
Need to get 4438 kB of archives.
After this operation, 17.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 libcap2 arm64 1:2.32-1 [15.5 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 libgdbm6 arm64 1.18.1-5 [26.4 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 zsh-common all 5.8-3ubuntu1 [3744 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 zsh arm64 5.8-3ubuntu1 [653 kB]
Fetched 4438 kB in 4s (1164 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libcap2:arm64.
(Reading database ... 4245 files and directories currently installed.)
Preparing to unpack .../libcap2_1%3a2.32-1_arm64.deb ...
Unpacking libcap2:arm64 (1:2.32-1) ...
Selecting previously unselected package libgdbm6:arm64.
Preparing to unpack .../libgdbm6_1.18.1-5_arm64.deb ...
Unpacking libgdbm6:arm64 (1.18.1-5) ...
Selecting previously unselected package zsh-common.
Preparing to unpack .../zsh-common_5.8-3ubuntu1_all.deb ...
Unpacking zsh-common (5.8-3ubuntu1) ...
Selecting previously unselected package zsh.
Preparing to unpack .../zsh_5.8-3ubuntu1_arm64.deb ...
Unpacking zsh (5.8-3ubuntu1) ...
Setting up zsh-common (5.8-3ubuntu1) ...
Setting up libcap2:arm64 (1:2.32-1) ...
Setting up zsh (5.8-3ubuntu1) ...
Setting up libgdbm6:arm64 (1.18.1-5) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...

Now try to move to zsh shell and you should get no errors!

# zsh
8d376ec5427e# zsh --version
zsh 5.8 (aarch64-unknown-linux-gnu)
8d376ec5427e# 
Ubuntu zsh error fix
Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.