How to Create a Beautiful PowerShell Prompt with Oh My Posh and Windows Terminal
Tags: devops, kubernetes, showdev, cloud
Published: 2023-09-04 13:25:55

As a developer working with tools like PowerShell, Kubernetes, Terraform, and others, having a well-customized and visually appealing terminal can significantly enhance your workflow. In this guide, we'll walk through the steps to create a stunning PowerShell prompt using Oh My Posh and Windows Terminal.

Prerequisites
Before we start, make sure you have the following prerequisites in place:

PowerShell Core: If you haven't already installed PowerShell Core, you can find installation instructions here.

Windows Terminal: You can install Windows Terminal by following the guide here.

After installing you can see the default UI as below:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iyyse92nitqanxrnea8u.png)



Oh My Posh: Install Oh My Posh by running the following command in PowerShell or Terminal:

```
winget install JanDeDobbeleer.OhMyPosh -s winget

```
Create a PowerShell Folder: Create a folder for PowerShell scripts on your C drive, for example, C:\Users\<your-username>\Documents\PowerShell. Inside this folder, create a file named profile.ps1.
Terminal Icons: Install the Terminal Icons module by running the following command in Windows Terminal:

```
Install-Module -Name Terminal-Icons -Repository PSGallery

```
Fonts: Download and install the Caskaydia Cove Nerd Font Complete from here. Install this font in C:\Windows\Fonts.
Configuration Steps
Open the profile.ps1 file you created in the PowerShell folder (C:\Users\<your-username>\Documents\PowerShell\profile.ps1).

Add the following lines to set up aliases for your tools:

```
$pwd = pwd
write-host "Using profile in '$pwd\Documents\PowerShell\profile.ps1':"
Import-Module oh-my-posh
Import-Module -Name Terminal-Icons

Set-PoshPrompt -Theme 'C:\Users\<your-username>\Documents\PowerShell\ohmyposhv3-v2.json'

```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/83ytz927ldvask091ohi.png)


After that the Terminal UI will look like this

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ij8ttbooz42rceecwmkd.png)


Download the ohmyposhv3-v2.json theme file from Scott Hanselman's GitHub. Save it in your PowerShell folder (C:\Users\<your-username>\Documents\PowerShell).
Open Windows Terminal and go to Settings.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5whiz1iz473uk6wungvq.png)
Set up PowerShell as the default shell for Windows Terminal.
In the Windows Terminal settings, navigate to Profiles > <Your Profile Name> > Appearance and change the font to CaskaydiaCove NFM.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mxqcgag20vpvog1xw4ik.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ymk3x808axx7hzom756v.png)
Save your settings.
Now, you have a beautifully customized PowerShell prompt with Oh My Posh and Windows Terminal. Enjoy your new, stylish, and efficient development environment!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iat9batibo4dr7ti6fw6.png)