Customize your Terminal on Windows!

Customize your Terminal on Windows!

Terminal customization options for Git Bash and Powershell!

I've seen a lot of people on their Linux machines flexing their terminal and the prompts as to how they look and well, I'm sure you have too, perhaps why you're here as well. Take a look at one I found from an article.

image.png Now this might be a bit extreme for us (or at least for the scope of this article), but you get the idea I'm sure, because what you'd probably see on Windows right now, is this.

image.png

Having said that, thanks to some amazing work from developers at oh-my-posh we get a handful of options to customize our terminal. Let's get going.

Install Windows Terminal

Right, open up Microsoft Store and install Windows Terminal, because hey, it's just better than cmd :) image.png

Customize Windows Terminal

image.png Under settings, you can customize the color scheme, font size, font style, etc. You can click on Open JSON file if you want to edit the Settings in JSON.

If you did not like the default themes, you can probably find your choice here .

image.png Simply click on Get Theme to copy the Schema and paste it as an object under the schema array inside the JSON file. After that, apply the customizations to your favorite shell, either Powershell or Git Bash.

image.png After your terminal looks decent enough, you can proceed further.

Install a Nerd Font

image.png Go to the Nerdfonts website and download your favorite Nerd font. Without one of these, your terminal prompts won't be able to render certain characters/emojis/icons. After installing one of the fonts, set the font face to the nerd font under Settings in Windows Terminal.

image.png

Install oh-my-posh and its themes

If you don't have winget, the Windows' command-line utility, you can go ahead and install Scoop from their official website .

We'll use scoop for this thread. Once scoop is installed, run the following command to install oh-my-posh

scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json

Preview Themes in Powershell

You can preview the themes by running the following script in Powershell.

Get-ChildItem -Path "$(scoop prefix oh-my-posh)\themes\*" -Include '*.omp.json' | Sort-Object Name | ForEach-Object -Process {
    $esc = [char]27
    Write-Host ""
    Write-Host "$esc[1m$($_.BaseName)$esc[0m"
    Write-Host ""
    oh-my-posh --config $($_.FullName) --pwd $PWD
    Write-Host ""
}

You'll be welcomed to a Gallery of different prompts with their filenames to pick from, and there are loads of them, so it's very unlikely that you'll fall out of options. image.png

If you are using Powershell, run the following commands to basically apply the theme to your prompt.

After opening $PROFILE in notepad, add the following line. Note the version here. You can find these under the themes folder -

notepad $PROFILE
# Add this to the file
oh-my-posh --init --shell pwsh --config ~/scoop/apps/oh-my-posh/<version>/themes/blue-owl.omp.json | Invoke-Expression
# Save and exit
. $PROFILE

If you are using Git Bash for Windows like me, you have to go to the Git/etc/profile.d folder, open up aliases.sh (you'll probably need admin permissions to save this file) and add the following lines (again, check the version) -

eval "$(oh-my-posh --init --shell bash --config ~/scoop/apps/oh-my-posh/<version>/themes/blue-owl.omp.json)"

At this point, your terminal looks great, but you can even go further inside the .omp.json file of your theme and customize it. You'll need to take a good look at the syntax used and the attributes required for alignments, new line, etc. It's a whole new world to explore.

Keep in mind, More customization => More productivity

Here's a look at our end result. Definitely nothing extraordinary, but I like it this way and it's definitely much better than what it was, previously.

image.png

I hope you enjoyed this little journey of customizing your terminal on Windows. Thanks for reading!

Did you find this article valuable?

Support Sreekesh Iyer by becoming a sponsor. Any amount is appreciated!