Fundamentals 8 min read

Master Zsh and Oh‑My‑Zsh: Install, Configure, and Customize Your Shell

This guide explains why Linux offers multiple shells, introduces Zsh and its powerful features, walks through installing Zsh and setting it as the default shell, and provides step‑by‑step instructions for adding Oh‑My‑Zsh, customizing themes, plugins, and managing updates or removal.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Zsh and Oh‑My‑Zsh: Install, Configure, and Customize Your Shell

Why Multiple Linux Shells?

Linux/Unix provides several shells (sh, bash, csh, etc.) because developers often create new shells to simplify complex tasks, leading to a variety of standard options. You can list the shells available on your system with:

cat /etc/shells

Introducing Zsh

Zsh is a powerful, programmable shell widely available on most Linux distributions. It coexists with the default bash shell and can be installed via package managers such as apt‑get, yum, or urpmi.

Out‑of‑the‑box command‑line completion and programmable completion.

Shared command history across all running shells.

Extended globbing that can replace many external find calls.

Improved variable and array handling.

Multi‑line command editing in the buffer.

Compatibility modes (e.g., emulate Bourne shell).

Highly customizable prompts, including right‑hand information and auto‑hide for long commands.

Loadable modules for TCP/Unix‑domain sockets, FTP client, advanced math functions, etc.

Full customizability.

Installing Zsh

On Ubuntu, after configuring the correct package source, install Zsh with:

sudo apt‑get install zsh

Configuring Zsh

You can replace your existing .bashrc or .profile with a Zsh configuration file ( ~/.zshrc). Copy a prepared .zshrc to your home directory, or edit the file directly to suit your needs.

Making Zsh the Default Shell

sudo usermod -s /bin/zsh username

or chsh -s /bin/zsh To revert to Bash: chsh -s /bin/bash If you prefer not to change the default, you can start Zsh manually with zsh and exit with exit.

Installing Oh‑My‑Zsh

Oh‑My‑Zsh extends Zsh with plugin management, theme support, and enhanced auto‑completion. Install it via Git:

git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

Backup your existing .zshrc and replace it with the template:

cp ~/.zshrc ~/.zshrc.orig
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

Or use the provided installation script:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Customizing Themes

Oh‑My‑Zsh ships with many themes located in oh-my-zsh/theme. Set the desired theme in ~/.zshrc:

ZSH_THEME="agnoster"   # example of a fancy theme

To select a random theme each session:

ZSH_THEME="random"

Managing Plugins

Edit the plugins array in ~/.zshrc to enable desired plugins, e.g.:

plugins=(git bundler osx rake ruby)

Updating and Uninstalling Oh‑My‑Zsh

Oh‑My‑Zsh prompts for updates weekly; you can disable the prompt by adding: DISABLE_UPDATE_PROMPT=true To manually upgrade: upgrade_oh_my_zsh To uninstall:

uninstall_oh_my_zsh zsh
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxShellcommand-linezshoh-my-zsh
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.