Oh My Zsh
Zsh configuration framework with plugins and themes.
Official WebsiteFeatures
Why use Oh My Zsh?
300+ plugins
Aliases and completion features for major tools like Git, Docker, npm, kubectl, and more.
150+ themes
A wide variety of prompt themes available, making it easy to change the appearance.
Huge community
Over 170k stars on GitHub. Active community for continuous development and support.
Easy configuration management
Organize .zshrc settings and manage plugins and themes centrally.
Installation
You can install it with a one-liner using curl or wget.
Using curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"Using wget
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"Note: The installation script will backup your existing .zshrc and create a new configuration file for Oh My Zsh.
Shell Configuration
After installation, edit ~/.zshrc to configure themes and plugins.
Basic configuration
# Oh My Zsh installation path
export ZSH="$HOME/.oh-my-zsh"
# Theme configuration (specify a theme name from the list below)
ZSH_THEME="robbyrussell"
# Plugin configuration (can specify multiple separated by spaces)
plugins=(git docker npm kubectl)
# Load Oh My Zsh
source $ZSH/oh-my-zsh.sh
# Add custom settings below
# export PATH="$HOME/bin:$PATH"
# alias ll="ls -la"Theme configuration
Change the prompt appearance by setting the theme name in the ZSH_THEME variable.
Popular themes
robbyrussell (default)
Oh My Zsh's default theme. Simple and lightweight.
agnoster
Powerline-style theme. Requires Nerd Font or Powerline Font.
af-magic
Clean theme with good balance of information display.
# Change theme example
ZSH_THEME="agnoster"
# Use a random theme
ZSH_THEME="random"
# Randomly select from specific themes
ZSH_THEME_RANDOM_CANDIDATES=(
"robbyrussell"
"agnoster"
"af-magic"
)Theme list: All themes are located in ~/.oh-my-zsh/themes/. You can also view previews on the official Wiki.
Plugin configuration
You can enable various features by adding plugin names to the plugins array.
Recommended plugins
| Plugin | Description |
|---|---|
| git | Git aliases and completion (gst, gco, gcm, etc.) |
| docker | Docker command completion |
| npm | npm command completion and aliases |
| kubectl | Kubernetes CLI completion |
| z | Jump to frequently used directories |
| sudo | Add sudo to the beginning with Esc×2 |
| history | History search aliases |
| extract | Extract various archive formats with x command |
Plugin configuration example
plugins=(
git
docker
docker-compose
npm
node
kubectl
z
sudo
history
extract
colored-man-pages
)Adding external plugins
You can easily add external plugins like zsh-autosuggestions and zsh-syntax-highlighting.
# Install zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
# Install zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
# Add to plugins in .zshrc
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)Prompt examples
Main aliases when the Git plugin is enabled.
Tips
Update Oh My Zsh
Update regularly to keep plugins and themes up to date.
# Update manually
omz update
# Configure automatic updates (~/.zshrc)
zstyle ':omz:update' mode auto # Enable auto-update
zstyle ':omz:update' frequency 7 # Check every 7 daysView aliases
You can view the aliases provided by plugins.
# Display all aliases
alias
# Search for Git plugin aliases
alias | grep git
# Check specific alias definition
which gstAdd custom aliases
You can add custom settings at the end of ~/.zshrc or in ~/.oh-my-zsh/custom/.
# ~/.zshrc or ~/.oh-my-zsh/custom/aliases.zsh
# Aliases for frequently used commands
alias ll="ls -la"
alias ..="cd .."
alias ...="cd ../.."
# Shortcuts to projects
alias proj="cd ~/projects"
# Docker related
alias dps="docker ps"
alias dcp="docker-compose"Improve startup speed
Installing too many plugins can slow down startup. Enable only the plugins you really need, and consider lazy loading for slow plugins likenvm. You can measure startup time withtime zsh -i -c exit.