The Z shell — a bash-compatible interactive shell with better completion, globbing, and prompt theming. Oh My Zsh is the config framework most people actually install it for, and it needs zsh 5.0.8 or newer.
Install
| System | Command |
|---|---|
| Arch / Manjaro / Omarchy | sudo pacman -S zsh |
| Ubuntu / Debian / WSL | sudo apt install zsh |
| macOS | brew install zsh |
| Fedora | sudo dnf install zsh |
| Alpine | apk add zsh |
| Termux (Android) | pkg install zsh |
macOS has shipped zsh as the default shell since Catalina — check zsh --version before reaching for Homebrew.
Verify
zsh --versionzsh 5.9.2 (aarch64-unknown-linux-gnu)Default Shell
chsh -s $(which zsh)Log out and back in, then confirm from a fresh terminal:
echo $SHELL/usr/bin/zshGotchas
chshonly accepts a shell listed in/etc/shells. If it refuses, append it first:sudo sh -c "echo $(which zsh) >> /etc/shells".- Fedora wants
sudo chsh $USERinstead (older versions:sudo lchsh $USER). - Intel Macs need the full path —
chsh -s /usr/local/bin/zsh— since Homebrew’s zsh is not on the system path at login. - Where
chshis unavailable (locked-down or LDAP accounts), putexec zshat the top of~/.bashrcinstead.
Corrupt history file
How to fix a corrupt zsh history file
{
cd ~
mv .zsh_history .zsh_history_bad
strings .zsh_history_bad > .zsh_history
fc -R .zsh_history
}