DEV Community

Chiranjib
Chiranjib

Posted on

1

Beautify WSL2 terminal with ohmyposh

Read on if you

  • Are using the combination: Windows, WSL2, Ubuntu
  • Don't like the look and feel of the limited terminal
  • Like me, aren't yet using Windows Terminal for some inexplicable reason

Prerequisites

  • Have a computer that runs Windows OS (Mine is Windows 10)
  • Enable WSL2 -> Here's how, if you need it
  • A little tech knowledge about how these things work, just enough to make small changes and understand what's going on

Step 1: Installation

Open Ubuntu in WSL and download oh-my-posh. Oh My Posh is a prompt theme engine for your shell (I, being a simpleton, am using bash). Their somewhat detailed installation instructions enable you to download and set it up smoothly.

Once the installation has completed, let's take small steps towards enabling it. Let's edit the ~/.bashrc file to ensure that it loads when we start.

export PATH=$PATH:~/.local/bin
if [ -f $(which oh-my-posh) ]; then
  eval "$(oh-my-posh init bash)"
fi
Enter fullscreen mode Exit fullscreen mode

Let's see what we just did:

  • assuming that oh-my-posh got installed in the location ~/.local/bin, we are ensuring that it's loaded in the PATH. This is necessary to be able to invoke the command itself.
  • since we are using bash, we invoked the command oh-my-posh init bash at startup, so that things are nice and pretty for us to use from the start.

Step 2: Selecting a theme

Discover all the ohmyposh themes that you can choose from, and download the file from the link provided there or just pick one from the list here: https://github.com/JanDeDobbeleer/oh-my-posh/tree/main/themes

Let's assume we have downloaded the necessary theme .json files in the directory ~/.poshthemes.

Let's now modify the file ~/.bashrc to pick the theme up as shown below:

if [ -f $(which oh-my-posh) ]; then
  eval "$(oh-my-posh init bash --config ~/.poshthemes/jandedobbeleer.omp.json)"
fi
Enter fullscreen mode Exit fullscreen mode

Step 3: Installing a Nerd Font

Oh My Posh requires a Nerd Font to work. So, explore all the nerd fonts, have your pick, and download the font to your windows system. Once, the font is downloaded, navigate to the font location, right click, and click Install.

Once installed, verify that the font is visible in the list of fonts: Win + R, type fonts. I went with Inconsolata.

Verifying the installed font

Step 4: Configure the installed font

As a final step, we need to configure the emulator, that is used by Windows. Launch Command Prompt or Ubuntu App, right click on the toolbar, click Properties. This should allow you to select the installed font. One easy to miss detail is that CMD works with Monospaced fonts only. So, the font that you had chosen, ensure that you've installed the Mono variant.

Choosing the installed Mono font

Quadratic AI

Quadratic AI – The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo 📊✨

Top comments (0)

Image of PulumiUP 2025

Let's talk about the current state of cloud and IaC, platform engineering, and security.

Dive into the stories and experiences of innovators and experts, from Startup Founders to Industry Leaders at PulumiUP 2025.

Register Now

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, cherished by the supportive DEV Community. Coders of every background are encouraged to bring their perspectives and bolster our collective wisdom.

A sincere “thank you” often brightens someone’s day—share yours in the comments below!

On DEV, the act of sharing knowledge eases our journey and forges stronger community ties. Found value in this? A quick thank-you to the author can make a world of difference.

Okay