Back to course

Installing and Configuring Zsh (Oh-My-Zsh)

Termux Masterclass: From Zero to Linux Power User on Android

35. Installing and Configuring Zsh (Oh-My-Zsh)

While Bash is robust, Zsh (Z Shell) offers advanced features like enhanced auto-completion, better command history, and powerful theme support. The popular framework Oh My Zsh (OMZ) brings these features to life.

1. Installing Zsh

bash $ pkg install zsh

2. Setting Zsh as Default Shell

Termux provides a utility to switch the default shell:

bash $ chsh -s zsh

You must restart Termux for this change to take effect.

3. Installing Oh My Zsh (OMZ)

OMZ simplifies configuration and provides hundreds of plugins and themes.

Prerequisite: Ensure git and curl are installed (pkg install git curl).

Installation Command:

bash $ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

OMZ will prompt you to set Zsh as the default shell (if you haven't already). Once installed, your prompt will look drastically different, incorporating the default 'robbyrussell' theme.

4. Customizing Zsh (The .zshrc)

Configuration is managed in ~/.zshrc.

bash $ nano ~/.zshrc

Look for the ZSH_THEME="..." line to change themes, or the plugins=(...) line to enable features like Git integration or syntax highlighting.