Pro Terminal for Pro Developers with Oh My Zsh
- Published on
- Reading time
- 3 min read
Upgrade your terminal with Zsh, Oh My Zsh, syntax highlighting, auto-suggestions and the Powerlevel10k theme, step by step on Ubuntu.
As we like to make everything easier for our community, in this article I explain how to turn your default shell into a pro terminal. You will install Zsh and Oh My Zsh, add two plugins that highlight your commands and auto-complete them from your history, install the fonts that make the icons render, and finish with the Powerlevel10k theme.
The commands below use apt-get, so they target Ubuntu and other Debian-based systems.
1. Install Zsh and Oh My Zsh
We start by installing Zsh and Oh My Zsh to add their features to our terminal. The first line installs the tools the installer needs, the second installs Zsh itself, and the third runs the official Oh My Zsh install script:
sudo apt-get -y install git curl wget
sudo apt-get -y install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Zsh and Oh My Zsh are now installed. Next we add some plugins to make the terminal easier to use.
2. Install the plugins
We add two plugins, zsh-syntax-highlighting and zsh-autosuggestions:
- zsh-syntax-highlighting highlights the commands you type in the terminal as you type them.
- zsh-autosuggestions remembers the commands you have written and auto-completes them for you.
Clone both into the Oh My Zsh custom plugins folder:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
echo "source ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Enable them in the config
Cloning is not enough; you need to enable the plugins in the Oh My Zsh config. Open it:
sudo nano ~/.zshrc
Search for the plugins line and change it to:
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)
3. Install the Powerline fonts
For Oh My Zsh themes to show icons, you need a font that contains them. Install the Powerline fonts:
sudo apt-get install fonts-powerline
You can also download the recommended fonts manually from the Powerlevel10k font installation guide.
4. Install the Powerlevel10k theme
Now it is time to make your terminal look pro.
-
Clone the Powerlevel10k theme into the Oh My Zsh custom themes folder:
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k -
Open the Oh My Zsh config again:
sudo nano ~/.zshrc -
Search for the
ZSH_THEMEline and change it to:ZSH_THEME="powerlevel10k/powerlevel10k" -
Close your terminal and open it again to restart Zsh, then start the configuration wizard:
p10k configure
The wizard asks a few questions about how you want the prompt to look. Once you finish configuring it, you will see your new theme.
Wrapping up
That is the whole setup: Zsh with Oh My Zsh as the base, syntax highlighting and auto-suggestions to make typing commands faster, Powerline fonts for the icons, and Powerlevel10k for the look. If you want to change the style later, just run p10k configure again.