Skip to content

Instantly share code, notes, and snippets.

@mhtamun
Last active July 21, 2025 13:03
Show Gist options
  • Save mhtamun/49963652648a117599236060f8633706 to your computer and use it in GitHub Desktop.
Save mhtamun/49963652648a117599236060f8633706 to your computer and use it in GitHub Desktop.
One‑Click Zsh Setup on Ubuntu | Oh My Zsh + Powerlevel10k + Plugins

🐚 Zsh + Oh My Zsh + Powerlevel10k Setup on Ubuntu

This guide helps you install and beautify your terminal using Zsh, Oh My Zsh, Powerlevel10k, and powerful plugins via a single script.


📦 Files

  • install_zsh.sh – Run this to install everything.
  • README_zsh_setup.md – This overview and further instructions.

🚀 Quickstart

chmod +x install_zsh.sh
./install_zsh.sh
exec zsh
p10k configure

💪 What This Script Does

1. Install Required Packages

sudo apt update && sudo apt install -y zsh git curl fonts-powerline
  • zsh: The Z shell, a more powerful alternative to bash.
  • git: Needed for cloning plugin repositories.
  • curl: For downloading install scripts.
  • fonts-powerline: Adds support for special glyphs/icons used by themes.

2. Install Oh My Zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  • Installs Oh My Zsh, a framework that manages Zsh configurations easily.

3. Install Powerlevel10k Theme

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
  • Adds a highly customizable and fast theme.

4. Set Powerlevel10k as Default Theme

sed -i 's/ZSH_THEME=.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc
  • Updates the theme setting in .zshrc file to use Powerlevel10k.

5. Install Recommended Plugins

# Syntax highlighting
 git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
   ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# Auto-suggestions
 git clone https://github.com/zsh-users/zsh-autosuggestions \
   ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# z
 git clone https://github.com/rupa/z \
   ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/z

Plugin Explanations:

  • zsh-syntax-highlighting: Colors your commands as you type, helping catch mistakes early.
  • zsh-autosuggestions: Suggests previously typed commands as you type.
  • z: Enables jumping to frequently used directories with fewer keystrokes.

6. Enable Plugins

sed -i 's/plugins=(git)/plugins=(git zsh-syntax-highlighting zsh-autosuggestions z)/' ~/.zshrc
  • Ensures those plugins are loaded by Zsh by modifying .zshrc.

7. Change Default Shell to Zsh

chsh -s $(which zsh)
  • Makes zsh your default shell every time you open a terminal.

✅ Final Step

After running the script, restart your terminal or run:

exec zsh

Then go through Powerlevel10k configuration wizard. Answer based on your preferences.


🔁 Optional: Re-run Powerlevel10k Wizard

If you want to reconfigure the look later:

p10k configure

If this command doesn't work, try:

source ~/.zshrc
#!/usr/bin/env bash
set -e
# 1. Install essentials
sudo apt update
sudo apt install -y zsh git curl fonts-hack-ttf bat fzf thefuck
# 2. Change default shell to Zsh
chsh -s "$(which zsh)" || echo "Please set your login shell to Zsh manually."
# 3. Install Oh My Zsh
export ZSH="$HOME/.oh-my-zsh"
if [[ ! -d "$ZSH" ]]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
# 4. Install Powerlevel10k theme
THEME_DIR="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
if [[ ! -d "$THEME_DIR" ]]; then
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$THEME_DIR"
fi
# 5. Install plugins
PLUGINS_DIR="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins"
for plugin in \
zsh-autosuggestions \
zsh-syntax-highlighting \
you-should-use \
zsh-history-substring-search \
bat; do
if [[ ! -d "$PLUGINS_DIR/$plugin" ]]; then
git clone https://github.com/zsh-users/$plugin.git "$PLUGINS_DIR/$plugin"
fi
done
# 6. Generate .zshrc
cat > ~/.zshrc <<'EOF'
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
you-should-use
zsh-history-substring-search
bat
fzf
thefuck
)
source $ZSH/oh-my-zsh.sh
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
EOF
echo "✅ Setup complete! Now run 'exec zsh' or open a new terminal, then run 'p10k configure'."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment