Getting Started with Oh My Zsh
You want a clean Zsh setup you can break without fear. Docker is perfect for that, as it's fast to spin up and easy to reset. In this guide, you’ll install Oh My Zsh, add two must-have plugins, and learn how to detach from a running container without killing it. We’ll also cover additional tips to maximize your setup.
What you’ll build
- A disposable Ubuntu 24.04 container with zsh, Oh My Zsh, and:
zsh-autosuggestions
for command suggestions as you typezsh-syntax-highlighting
for readable, colour-coded commands
You can practice and tweak your .zshrc
here, then copy the config to your real machine later.
Prerequisites
- Docker is installed and running
- Basic terminal comfort
1) Create a Docker container
Start a vanilla Ubuntu 24.04 container with a shell:
docker run -it --name ohmyzsh-setup ubuntu:24.04 bash
You’re now inside the container as root
.
2) Install Zsh and essentials
Update apt and install the tools we’ll use:
apt update && apt install -y wget zsh git vim
3) Install Oh My Zsh
Run the official installer:
cd
sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
The installer sets up ~/.oh-my-zsh
and creates a starter ~/.zshrc
.
If it doesn’t drop you into Zsh automatically, just run:
zsh
4) Detach from the container without stopping it
Sometimes, you need to return to your host shell while keeping the container running.
- Press Ctrl+P, then Ctrl+Q to detach.
The container continues to run in the background. Later, jump back in with:
docker attach ohmyzsh-setup
Or open a fresh shell:
docker exec -it ohmyzsh-setup zsh
5) Add autosuggestions and syntax highlighting
Clone both plugins into Oh My Zsh’s custom/plugins
directory:
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
Now enable them in your ~/.zshrc
.
Open the file:
vim ~/.zshrc
Find the plugins=(...)
line and set it like this (order matters—put syntax highlighting last):
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
Save and reload:
source ~/.zshrc
You should now see:
- Autosuggestions in a faint colour as you type—press → (right arrow) or
End
to accept. - Syntax highlighting that colours commands and flags before you run them.
6) Quick verification
Try a few commands:
gi # autosuggests 'git'
git st # autosuggests 'git status'
ls --hel # shows highlighting for a valid/invalid flag as you type
7) Optional: tweak your theme
The default theme is robbyrussell
. You can switch to something simple like clean
:
sed -i 's/^ZSH_THEME=.*/ZSH_THEME="clean"/' ~/.zshrc && source ~/.zshrc
Or browse through hundreds of community themes. Some themes show git status, battery level, or Kubernetes context right in your prompt.
8) Power-up with more plugins
The real magic of Oh My Zsh is in its plugin ecosystem. Explore all available plugins here:
👉 https://github.com/ohmyzsh/ohmyzsh/wiki/plugins
Some favourites for DevOps workflows:
docker
– tab-completion and shortcuts fordocker
commandskubectl
– autocompletion for Kubernetes clustersterraform
– aliases for Terraform commandspip
/python
– helpers for Python projectsfzf
(withz
orfasd
) – fuzzy finders to jump around directories and command history
To enable, add them to your plugins=(...)
list in .zshrc
.
9) Use aliases and custom functions
Shortcuts save time. Edit your .zshrc
and add things you type often:
alias k=kubectl
alias gco='git checkout'
alias gst='git status'
alias dcu='docker compose up -d'
For more complex workflows, create shell functions:
function kctx() {
kubectl config use-context "$1"
}
10) Persist useful history
Zsh lets you configure how history behaves. Add this to your .zshrc
:
HISTFILE=~/.zsh_history
HISTSIZE=50000
SAVEHIST=50000
setopt share_history # Share command history across sessions
setopt hist_ignore_all_dups
This keeps your history long and clean—great for finding old commands with Ctrl+R
.
11) Speed things up
Oh My Zsh can slow down if you load too much. A few tricks:
- Keep
plugins=(...)
minimal—only what you use daily - Use the zsh-fast-syntax-highlighting fork if regular highlighting feels sluggish
- If your prompt feels slow, switch to a lighter theme
🔥 Top 10 Oh My Zsh Plugins for DevOps
Oh My Zsh has hundreds of plugins. For DevOps work, these 10 deliver the biggest productivity boost:
1. git
Aliases and helpers for common Git commands.
gst # git status
gco branch # git checkout branch
gcmsg "msg" # git commit -m "msg"
2. docker
Tab-completion and handy shortcuts for Docker.
dps # docker ps
dcu # docker-compose up
dcd # docker-compose down
3. kubectl
Simplifies Kubernetes commands.
k get pods
k describe svc my-service
Add this alias to your .zshrc
for speed:
alias k=kubectl
4. terraform
Aliases for Terraform workflows.
tf init
tf plan
tf apply
5. aws
Completion and shortcuts for AWS CLI commands.
aws s3 ls
aws ec2 describe-instances
6. pip & python
Helpers for Python environments.
pipup # upgrade all pip packages
pyclean # remove .pyc files recursively
7. npm & node
For JavaScript/TypeScript developers managing tools and builds.
npm-outdated # check outdated packages
node -v # autocomplete versions
8. fzf
(Fuzzy Finder—requires fzf
installed)
Search history, files, or directories lightning-fast.
Ctrl+R # fuzzy search through history
Ctrl+T # fuzzy search for files
9. z (autojump)
Jump to frequently used directories with just a few letters.
z project # jumps to ~/work/devops/project
10. history-substring-search
Search history interactively with arrow keys.
# Type 'dock' then press ↑ to cycle through past `docker` commands
How to enable these plugins
Edit your .zshrc
and add them:
plugins=(
git
docker
kubectl
terraform
aws
pip
python
npm
node
fzf
z
history-substring-search
)
Then reload:
source ~/.zshrc
Cleanup and repeat
Want to start over?
docker rm -f ohmyzsh-setup
Then rerun step 1. This container workflow gives you a safe playground, perfect for learning, testing themes, and building a .zshrc
you’ll trust your daily driver.
Final thoughts
Oh My Zsh is more than a pretty prompt. It’s a productivity framework. By experimenting in Docker, you get a safe lab to test themes, plugins, and custom scripts, then take the best parts back to your main environment.
Start small: one theme you like, two or three plugins, and a couple of custom aliases. Over time, you’ll tune Zsh into a shell that feels like an extension of your brain.