Enhance your terminal experience on Windows

Duncan Lew
6 min readMar 5, 2022

--

Are you still using the Command Prompt on your Windows machine? It really feels like the relic of the past and is a tool ripe for improvement. Many modern features that we have come to expect from a command-line app aren’t available. No tabs, no syntax highlighting, and quite outdated:

Old Command Prompt application for Windows

Luckily, Microsoft has invested its efforts into building the next-generation terminal app, called Windows Terminal. This new app supports long-awaited features like multi-tabs, emoji, theming, and many other tweaks that developers will love to use. This and many other tools will allow us to upgrade our terminal experience to look like this:

Tools that we will be using to create this terminal experience are:

  • Windows Terminal
  • Windows package manager: winget
  • Nerd Font
  • PowerShell
  • Oh-my-posh

This will be a very straightforward guide to upgrading your terminal experience with pure Windows tools. So let’s get started!

1. Install Windows Terminal

The new command-line application Windows Terminal might already be installed on your Windows machine. If this is not the case, the easiest way to get it is by installing Windows Terminal from the Microsoft Store. This method makes it possible to always get the latest releases automatically for your Windows Terminal.

2. Install Winget

To make installing all the tools as easy as possible, we will be using the built-in Windows Package Manager called winget. This is a command-line tool bundled with Windows 11. You can check in the Microsoft Store whether you already have this installed. This package manager is called App Installer in the Microsoft Store.

3. Install PowerShell

PowerShell is a command-line shell and scripting language developed by Microsoft. There is a bit of confusion with two variants that exist for PowerShell: Windows PowerShell and PowerShell Core. PowerShell Core is the name used for PowerShell starting for version 7.0. All versions before version 7.0 are denoted by Windows PowerShell. The main difference between these two is that PowerShell Core is the new open-source version built on the .NET Core runtime which opens the door for cross-system compatibility. Using the .NET Core runtime also enables backwards compatibility with previous versions of PowerShell. We will be using PowerShell Core (a.k.a V7) to upgrade our Windows Terminal experience.

PowerShell Core can be downloaded from the PowerShell GitHub repository. If you’re running a 64-bit Windows machine, use the LTS .msi installer for Windows (x64). For 32-bit use the x86 installer. When you go through the installer of PowerShell Core, the default pre-selected options are fine.

4. Setup PowerShell as default shell in Windows Terminal

When you start up Windows Terminal, Windows PowerShell will still start up as the default shell as opposed to the more modern PowerShell Core that you just installed. Inside Windows Terminal, the more modern PowerShell Core is just called PowerShell. Changing the default shell can be done very easily in Windows Terminal.

Click on the downward-facing arrow at the top and then select Settings.

A Settings tab will open and show you the Startup configuration as follows:

Click on the drop down-window for the Default profile and select PowerShell.

Click Save afterward and Windows Terminal will always start up PowerShell as the default shell.

Optional step for Windows 11 users

If you’re using Windows 11, you can set up Windows Terminal as the default command-line tool when you start up PowerShell or Command Prompt separately. This ensures that you are always using Windows Terminal as the default terminal emulator. You can do this from the Settings from your Windows Terminal by selecting Windows Terminal as the Default terminal application:

5. Install a Nerd Font

We will be using a theming engine that requires lots of special glyphs. The nerd font that we will be using is Meslo LGM NF. This font can be downloaded from this link. There are also other Nerd Fonts that you can choose from by visiting the Nerd Fonts GitHub Page.

After installing your Nerd Font, you need to set this as the default font in Windows Terminal. Go to the settings page of Windows Terminal and click on the PowerShell profile in the bottom left.

Afterward, click on the Appearance tab and select MesloGL NF as the Font face. Make sure to click Save at the end.

Now you’re all set to start the next step, where the real fun begins!

6. Oh My Posh

What will bring your terminal experience to life and enhance your terminal journey when you’re using the command-line tools is a theming engine. We will use Oh My Posh to achieve this result.

To install Oh My Posh, run the following command in Windows Terminal

winget install JanDeDobbeleer.OhMyPosh

Now your existing prompt needs to be replaced by Oh My Posh inside the PowerShell profile. This profile can be accessed with the $PROFILE variable. The catch is that this variable points to a file that doesn’t exist yet. Make sure that the following empty file exists on your machine and replace USER with your Windows user.

C:\Users\USER\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

After the empty PowerShell profile has been created, type the following in Windows Terminal:

notepad $PROFILE

Add the following line in Notepad and then save it:

oh-my-posh --init --shell pwsh --config https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$(oh-my-posh --version)/themes/jandedobbeleer.omp.json | Invoke-Expression

Close your Windows Terminal and reopen it again and you will be greeted with some awesomeness!

Conclusion

If you’re using the Windows Terminal on a daily basis for your job, it will be definitely worth it to do these upgrades. From my experience, it’s quite painless to configure the different parts of a Windows machine to our liking in 2022. A terminal that is a feast to our eyes, makes our job more enjoyable to do. Small changes like these can give us a big productivity boost.

If the content was helpful, feel free to support me here:

--

--

No responses yet