I absolutely love working from the Terminal, whether that's Windows Terminal or whichever flavor of Linux I'm using that month. I've used Linux for nearly two decades, and am more at home on the command-line than anywhere else on my desktop. But once I've set up Windows Terminal to my liking, something is missing from my usual Terminal Emulation.
That's some robust theming to get it looking exactly how I want, with some handy extra accessories to let me stay in the command line for as long as possible. I find I'm more productive when I'm in a window with fewer distractions, but sometimes a little glow keeps my attention from wandering. The Windows Terminal is a far cry from the old CMD window, as you can use tabs, and run PowerShell, CMD, WSL, and others, all without needing a separate window. But it's a little bland normally, so let's do something about that.
What is Oh My Posh, and why would you want it?
Time to bling out your Terminal sessions
Oh My Posh has been around for what seems like forever, but it's now available in pretty much every terminal session you might use. It's a custom prompt engine that enables restyling the prompt string to show relevant information at a glance.
This could be the folder structure you're working in, tooltips about the commands you're using, or the status of the Git repo you're working on a local copy of, letting you know whether you're ahead or behind the mainline repo and what your next code push might do. You can create pretty elaborate tools with it, customized to the tools you use, like Kubernetes to show the currently active context name and namespace, or Docker context, or active AWS profile and region.
You can also use it to add other related context, such as what's playing in your Spotify app or your Strava metrics. And, of course, a wealth of information about your current computer, such as battery level, time, and local weather.
It only takes a few minutes to bling out your Terminal
And it's so much nicer to use afterward
Okay, before we get to Oh My Posh, two things should really be done first. You could do these afterwards, but it's easier this way around as you'll have the font you need later. The first is to set your Color Scheme in the Appearance tab for the profiles you'll use in Windows Terminal. This can be any of the existing ones, or the hundreds on Windows Terminal Themes, where you'll need to copy the JSON, open the Windows Terminal JSON file with the button at the bottom of the Settings menu, and paste it into the "schemes" field.
Now we need a Nerd Font. These are programming-focused font families with tons of glyphs, along with the standard characters. Pick any from the GitHub (or download them all for future use), and find your favorite. I like Caskaydia Cove Nerd Font, and you'll want the Complete Windows Compatible version if using it in the Windows Terminal, or any of the other complete versions on Linux. Once installed, restart Windows Terminal, then go select the font from the Appearance tab.
Time for Oh My Posh
The reason we needed the Nerd Font is that the beautification of Oh My Posh would otherwise show up as blank rectangles. Type the following in your terminal window:
winget install JanDeDobbeleer.OhMyPosh
Then restart your Terminal, and open PowerShell. Run the following to see if it installed correctly:
oh-my-posh
and then open your PowerShell profile. If you get a message that "Microsoft.Powershell_profile.ps1" is not found, press Yes to create it.
notepad $PROFILE
Paste the following
oh-my-posh --init --shell pwsh --config "jandedobbeleer" | Invoke-Expression
Save the file, restart the Terminal and you should see all the glory of colored text.
Tweaking things to your liking is going to take longer
I also like to install Winfetch, which prints system information in the terminal and makes it feel very Linux-y.
In PowerShell, run:
Install-Script -Name pwshfetch-test-1
Then open the $PROFILE again in Notepad, and add the following line to the end:
Set-Alias winfetch pwshfetch-test-1
Save the file, restart the Terminal again, and then run winfetch to see your system stats in the terminal window, without having to click through several layers of Settings.
The only thing that's left is to tweak things to your liking. Maybe you want a custom theme, or you want related information that isn't already shown while you're working in the command line. The scripting engine in Oh My Posh is potent, and it has a huge community to find inspiration from.
The terminal can be a very colorful place if you want it to be
It's no secret that I love working from the Terminal, and many computer users feel the same. That doesn't mean your CLI needs to be boring and monochrome; you can jazz things up pretty quickly thanks to the wealth of customization options, fonts, and themes out there. And if you don't see a theme you like, most of the tools are relatively easy to customize, so you can have your CLI in living color.
