Introduction
I've been a bash user for years. It's the default on most Linux systems and Mac OS X, and it works fine. But I kept hearing about Zsh (Z Shell) and how much better it is – better tab completion, better history searching, more customization options.
The problem is that Zsh is intimidating to configure. The configuration file can be hundreds of lines long, and getting it right requires deep knowledge of shell scripting.
Then I discovered Oh My Zsh, a new framework released in August that makes Zsh incredibly easy to use. It's like getting all the power of Zsh without having to be a shell scripting expert.
What is Zsh?
Before talking about Oh My Zsh, let's cover the basics. Zsh (Z Shell) is an alternative to bash that's been around since 1990. It has many improvements over bash:
- Better tab completion – More intelligent and context-aware
- Shared history – History synced across all open terminals
- Spelling correction – Suggests corrections for typos
- Themeable prompts – More customization options
- Better globbing – More powerful pattern matching
- Plugin system – Extend functionality easily
The downside? Configuring it is complex. That's where Oh My Zsh comes in.
What is Oh My Zsh?
Oh My Zsh is a framework for managing your Zsh configuration, created by Robby Russell. It provides:
- Pre-configured themes – Beautiful prompts out of the box
- Plugin system – Easy to enable/disable plugins
- Sensible defaults – Good configuration without tweaking
- Community driven – Growing collection of themes and plugins
- Easy updates – Keep your configuration current
Think of it as a curated, pre-configured Zsh setup that just works.
Installation
Installing Oh My Zsh is simple. First, make sure you have Zsh installed:
On Ubuntu/Debian:
sudo apt-get install zsh
On Mac OS X: Zsh is already installed on Leopard and Snow Leopard.
Set Zsh as your default shell:
chsh -s /bin/zsh
Log out and back in for the change to take effect.
Install Oh My Zsh:
wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
That's it! Oh My Zsh is now installed in ~/.oh-my-zsh/ and your .zshrc has been configured.
First Impressions
After installation, open a new terminal. You'll immediately notice the difference:
➜ ~
Instead of the boring bash prompt, you get a colorful, informative prompt. If you're in a git repository, it shows branch information:
➜ my-project git:(master) ✗
The ✗ indicates uncommitted changes. This is incredibly useful when working with git.
Choosing a Theme
Oh My Zsh comes with many themes. Edit ~/.zshrc to change themes:
ZSH_THEME="robbyrussell" # Default theme
Try different themes:
ZSH_THEME="agnoster" # Clean, git-aware
ZSH_THEME="bira" # Two-line prompt
ZSH_THEME="avit" # Minimalist
ZSH_THEME="random" # Random theme each time
Browse all themes:
ls ~/.oh-my-zsh/themes/
Each theme changes how your prompt looks and what information it displays.
My favorite: robbyrussell (the default)
It's clean, shows git status, and doesn't clutter the prompt. Simple and effective.
Enabling Plugins
Oh My Zsh includes many plugins. Enable them in .zshrc:
plugins=(git ruby rails osx)
Some useful plugins:
git – Git aliases and functions (enabled by default)
gst– git statusga– git addgc– git commitgp– git push- Many more…
osx – Mac OS X specific (if you're on a Mac)
tab– Open current directory in new tabofd– Open current directory in Finderquick-look– Quick Look a file
rails – Rails aliases
rc– rails consolers– rails serverrg– rails generate
ruby – Ruby aliases and functions
sudo – Press ESC twice to add sudo to current command
extract – Universal extract command for any archive format
Enable multiple plugins:
plugins=(git osx rails ruby brew sudo extract)
The plugin system is simple but powerful.
Git Integration
This is where Oh My Zsh really shines. The git plugin provides dozens of aliases:
gst # git status
gd # git diff
gaa # git add --all
gcmsg # git commit -m
gp # git push
gl # git pull
gco # git checkout
gcb # git checkout -b
gm # git merge
grb # git rebase
glog # git log --oneline --decorate --color --graph
The prompt shows git information automatically:
➜ blog git:(master) # Clean working directory
➜ blog git:(master) ✗ # Uncommitted changes
➜ blog git:(feature-branch) ✗ # On a feature branch with changes
This visual feedback is fantastic. You always know your git status without running git status.
Tab Completion
Zsh's tab completion is phenomenal, and Oh My Zsh makes it even better.
Command completion:
git che<TAB>
# Expands to: git checkout
Argument completion:
git checkout <TAB>
# Shows list of branches
Path completion:
cd /u/l/b<TAB>
# Expands to: cd /usr/local/bin
It completes in the middle of words! This is a huge time-saver.
Case-insensitive completion:
cd desk<TAB>
# Finds: Desktop, even with wrong case
Correction:
$ cd /urs/local
zsh: correct 'urs' to 'usr' [nyae]?
Zsh notices typos and suggests corrections.
History Search
The history search in Zsh with Oh My Zsh is excellent:
Incremental search:
Press Ctrl+R and start typing – it searches your history as you type.
Shared history: All open terminals share the same history. No more running a command in one terminal and not finding it in another.
Better history navigation: Start typing a command, then use arrow keys to cycle through matching commands from history:
git <UP ARROW>
# Cycles through all git commands in history
Customization
Oh My Zsh doesn't lock you into its way of doing things. Customize in ~/.zshrc:
Custom aliases:
alias blog='cd ~/projects/blog && mate .'
alias server='python -m SimpleHTTPServer 8000'
Environment variables:
export EDITOR=vim
export PATH="/usr/local/bin:$PATH"
Custom functions:
# Create and cd into directory
mkcd() {
mkdir -p "$1" && cd "$1"
}
Override plugin settings:
# Change git log alias
alias glog='git log --oneline --decorate --all --graph'
All your customizations survive Oh My Zsh updates.
Practical Workflow
Here's how Oh My Zsh improves my daily workflow:
Starting a project:
cd ~/projects/my-app # Tab completion on directory
gst # Check status
gco -b new-feature # Create new branch
# Prompt shows: ➜ my-app git:(new-feature)
Making changes:
mate app/models/user.rb # Edit file
gd # See changes
gaa # Stage all changes
gcmsg "Add user validation" # Commit with message
gp origin new-feature # Push to remote
Searching history:
# Forgot how to run tests?
rake<UP ARROW>
# Cycles through all rake commands
The prompt always shows my current branch and status. The git aliases save dozens of keystrokes per day. Tab completion is mind-reading fast.
Coming from Bash
If you're a bash user, the transition is smooth:
Bash works in Zsh: Your bash knowledge transfers. Most bash scripts run in Zsh without modification.
Your dotfiles still work: Aliases and functions from .bash_profile can be copied to .zshrc.
Learning curve is minimal: The basics are the same. The improvements are additions, not replacements.
The hardest part? Remembering you're using Zsh when you ssh into a server that's still running bash.
Performance
Bash starts instantly. Zsh with Oh My Zsh takes a fraction of a second longer – maybe 0.5 seconds on my MacBook.
This is the trade-off for all the features. For me, it's worth it. If you need faster startup, you can disable plugins you don't use.
The Community
Oh My Zsh is on GitHub and has an active community. People are contributing new themes and plugins regularly.
Found a bug? Submit an issue. Have an idea for a plugin? Contribute it back.
This community-driven approach means Oh My Zsh will keep getting better.
Tips and Tricks
Alias reference:
alias | grep git # See all git aliases
Update Oh My Zsh:
upgrade_oh_my_zsh
Disable auto-update prompts:
# In .zshrc
DISABLE_AUTO_UPDATE="true"
Use custom plugins:
Create ~/.oh-my-zsh/custom/plugins/yourplugin/yourplugin.plugin.zsh
Theme customization:
Create ~/.oh-my-zsh/custom/yourtheme.zsh-theme
Downsides
Nothing is perfect:
Startup time: Slightly slower than bash (though barely noticeable).
Learning curve: Some Zsh-specific features require learning.
Not universal: Servers run bash. You need to know both.
Plugin quality varies: Some plugins are excellent, others are meh.
For me, the benefits far outweigh these minor issues.
Why I Switched
I switched from bash to Zsh with Oh My Zsh because:
- Git integration – The visual git status in the prompt is invaluable
- Better completion – Tab completion is smarter and faster
- Productivity – Git aliases save me hundreds of keystrokes per day
- Aesthetics – My terminal looks better, and that makes me happy
- Easy configuration – No shell scripting expertise needed
The transition was painless, and the productivity boost was immediate.
Getting Started
My recommendation for getting started:
- Install Oh My Zsh – Follow the installation steps above
- Use the default theme – Get comfortable before customizing
- Enable a few plugins – Start with:
git,osx(if on Mac), andsudo - Learn the git aliases – These are the most useful
- Customize gradually – Add aliases and functions as needed
Don't try to learn everything at once. Oh My Zsh works great out of the box.
Is It Worth Switching?
If you:
- Use the terminal regularly
- Work with git
- Want a better command-line experience
- Like customizing your environment
Then yes, absolutely try Oh My Zsh. It costs nothing but 5 minutes to install, and it makes the terminal so much nicer to use.
If you rarely use the terminal or are happy with bash, stick with what works.
Resources
- GitHub: https://github.com/robbyrussell/oh-my-zsh
- Wiki: https://github.com/robbyrussell/oh-my-zsh/wiki
- Themes: https://github.com/robbyrussell/oh-my-zsh/wiki/themes
- Plugins: https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
The wiki has excellent documentation on themes, plugins, and customization.
Recaping
Oh My Zsh transforms the terminal from a utilitarian tool into something beautiful and productive. The git integration alone justifies the switch. Add in better tab completion, a plugin system, and gorgeous themes, and you have a compelling upgrade.
The best part? It's easy. No arcane shell scripting required. Install it, choose a theme, enable some plugins, and you're done. Your terminal is now significantly better.
I've been using Oh My Zsh for a few months now, and I'm not going back to bash. The productivity improvements are real, and the terminal is simply more pleasant to work in.
If you spend any significant time in the terminal, do yourself a favor and try Oh My Zsh. Your future self will thank you.