Skip to content

Oh My Zsh

Why use Oh My Zsh

When working in the terminal, you'll find the default Bash shell has a plain interface and limited features. Oh My Zsh is a framework for managing Zsh configuration, making your terminal more beautiful and efficient.

Beautiful terminal interface

Oh My Zsh provides many themes with Git branch display, command execution time, colored prompts, and more — all at a glance.

Powerful auto-completion

Zsh's auto-completion is smarter than Bash, supporting fuzzy matching, command argument hints, and more, significantly improving input efficiency.

Rich plugin ecosystem

Oh My Zsh includes 300+ plugins covering Git, Docker, Python, Node.js, and other common tools, making terminal operations more convenient.

Cross-platform support

Oh My Zsh works on macOS, Linux, and WSL.

Installing Zsh

macOS

brew install zsh

Linux

sudo apt install zsh

Windows (WSL)

sudo apt install zsh

Set Zsh as default shell

chsh -s $(which zsh)

You need to restart the terminal or re-login for changes to take effect.

Installing Oh My Zsh

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

Choose a theme

Edit ~/.zshrc and modify ZSH_THEME:

# Recommended theme: agnoster (requires font installation)
ZSH_THEME="agnoster"

# Or use robbyrussell (default, no extra font needed)
ZSH_THEME="robbyrussell"

If using the agnoster theme, you need to install Nerd Fonts for special characters to display correctly.

Enable common plugins

Edit the plugins section in ~/.zshrc:

plugins=(
    git                  # Git aliases and completion
    docker               # Docker command completion
    docker-compose       # Docker Compose completion
    python               # Python command completion
    pip                  # Pip command completion
    node                 # Node.js related commands
    npm                  # npm command completion
    zsh-autosuggestions  # History command suggestions (requires extra install)
    zsh-syntax-highlighting  # Command syntax highlighting (requires extra install)
)

Install additional plugins

# zsh-autosuggestions: show history command suggestions as you type
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# zsh-syntax-highlighting: real-time command syntax highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Reload configuration after installation:

source ~/.zshrc

Common Git aliases (provided by Oh My Zsh)

g       # git
gs      # git status
ga      # git add
gc      # git commit
gp      # git push
gl      # git pull
gd      # git diff
gb      # git branch
gco     # git checkout

Other resources