My ZSH shell setup.
Table of Contents
If you're not a fan of the standard command-line shell like bash or sh, you should switch to ZSH — I'll show you how to install and configure it.
If you’re tired of the standard look of your command-line shell and want to boost your productivity while working in the console, this article is for you! We’ll go over how to install and configure the advanced zsh shell, and set up a few handy plugins along the way.
Stage 1: Installing Zsh (if it’s not installed yet)
On macOS: Starting with Catalina, Zsh is the default shell. Check your current version:
zsh --version
If you need to update or install it: brew install zsh
On Ubuntu/Debian:
sudo apt update -y && sudo apt install zsh -y
After installing, make Zsh your default shell:
chsh -s $(which zsh)
(You’ll need to restart your terminal for the changes to take effect.)
Stage 2: Installing Oh My Zsh
Oh My Zsh is a framework for managing your Zsh configuration. Installing it is very simple:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Or via wget:
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Stage 3: Choosing and setting up a theme (the best and most interesting part)
This choice is subjective, but the community favorite — and my personal pick — is Powerlevel10k.
Why do I like Powerlevel10k (p10k)?
- Incredibly fast (the fastest of the “powerline” themes).
- Unlimited customization through a built-in configuration wizard.
- Shows a ton of useful info: Git status, Python/Node.js version, command execution time, battery level, and much more.
- Comes with built-in “presets” for a good-looking layout.
Installing Powerlevel10k:
-
Clone the theme repository into the Oh My Zsh directory:
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k -
Open the
~/.zshrcconfig file in a text editor (for example,nano ~/.zshrc). -
Find the line
ZSH_THEME="robbyrussell"and change it to:ZSH_THEME="powerlevel10k/powerlevel10k" -
Save the file and reload Zsh:
source ~/.zshrc -
After reloading, the automatic Powerlevel10k configuration wizard will launch. It’ll ask you a few questions about your style preferences and show you a preview. Just follow the prompts — it’s the easiest way to get the perfect theme! If the wizard doesn’t start automatically, you can run it manually:
p10k configure.
Stage 4: Installing the most essential productivity plugins
Plugins are Oh My Zsh’s superpower. Here’s the TOP 5 must-have plugins:
-
zsh-autosuggestions: Suggests commands based on your history. Just press
→orCtrl+Fto accept the suggestion.-
Installation:
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
-
-
zsh-syntax-highlighting: Highlights commands — correct ones in green, invalid ones in red. Incredibly convenient.
-
Installation:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
-
-
web-search: Lets you search right from the console. Examples:
google how to set up zshddg what is dockergithub ohmyzsh- (Already included in the standard Oh My Zsh set — you just need to add it to the plugin list.)
-
git: A huge collection of Git aliases. For example:
gstinstead ofgit statusgaainstead ofgit add --allgcmsg "commit"instead ofgit commit -m "commit"gl/gpinstead ofgit pull/git push- (Also already included in the standard set — again, just add it to the plugin list.)
-
sudo: Press
ESCtwice to automatically prependsudoto the current command. A real time-saver.
How to enable plugins:
Open ~/.zshrc again. Find the line:
plugins=(git)
And replace it with a list of all the plugins you need (important: zsh-syntax-highlighting must be last!).
plugins=(
git
web-search
sudo
zsh-autosuggestions
zsh-syntax-highlighting
)
Save the file and apply the changes:
source ~/.zshrc
Stage 5: Extra upgrades (optional, but pretty cool)
1. Installing Nerd Fonts
For icons and special characters to display correctly in Powerlevel10k, you absolutely need a Nerd Font.
- Download any Nerd Font you like (for example, Meslo Nerd Font, FiraCode Nerd Font, Hack Nerd Font) from the website.
- Install it on your system.
- In your terminal’s settings (iTerm2, Windows Terminal, GNOME Terminal, etc.), switch the font to the Nerd Font you just installed. This is a critical step!
2. Setting up aliases in ~/.zshrc
Add your own aliases for frequently used commands to the end of your ~/.zshrc file:
# My Custom Aliases
alias update='sudo apt update && sudo apt upgrade -y' # For Ubuntu/Debian
alias cls='clear'
alias zshconfig='nano ~/.zshrc'
alias ohmyzsh='nano ~/.oh-my-zsh'
alias ..='cd ..'
alias ...='cd ../..'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
I also added a bunch of aliases for working with kubectl, but not everyone uses that tool, so I’ll give an example of those in a separate article.
3. Setting up colored ls output
- On macOS:
brew install coreutilsand add the aliasalias ls='gls --color=auto'. - On Linux: it’s usually already set up. Make sure your
~/.zshrchas a line like:export LS_COLORS="di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"(or something similar).
Stage 6. If you don’t feel like doing all this by hand
If you don’t want to go through all these steps manually, you can just run a single script and have all the settings applied for you.
To do that, check out this repository, grab the script, and start the installation. Here’s how:
-
Download the script from the source
curl -O https://raw.githubusercontent.com/ni-gushch/zsh-setup/master/zsh_setup.sh -
Make it executable:
chmod +x zsh_setup.sh -
Run it:
sudo ./zsh_setup.sh
Summary
After all these steps, you end up with:
- An incredibly good-looking and informative theme (Powerlevel10k).
- Smart command suggestions on the fly (autosuggestions).
- Syntax highlighting to help avoid mistakes (syntax-highlighting).
- A ton of handy shortcuts for Git and more.
- Quick search right from the console.
The final step — restart your terminal or run source ~/.zshrc and enjoy your new, incredibly productive shell.