How to Personalize Your Windows Terminal Experience with Oh My Posh Theme for PowerShell, WSL/Ubuntu and more!

--

First of all, special thanks for Scott Hanselman who demonstrated how to customize the Windows Terminal in Windows 10/11.

Applying acrylic material effect to our windows terminal 10/11 👨‍💻

  1. Go to Microsoft Store > Search “Windows Terminal” > Update windows terminal to latest version.

Result.

2. Open windows terminal settings

3. Navigate to Profiles > Windows PowerShell > Additional settings “Appearance”

4. Scroll down to enable the Acrylic material toggle and adjust background opacity based on your preference.

Result

5. Repeat the process for other terminals CMD or other terminals you have on your windows.

Example for command prompt (CMD)

Result

Adding Caskaydia cove font 👌

  1. Download & Install Caskaydia cove nerd font. click here

2. After downloading unzip file > select all files > right click & select “install for all users”

3. Open windows terminal > settings > select windows powershell > additional settings “appearance”

4. Select font face > Caskaydia Nerd font mono > Click “Save”

5. Repeat the process for other terminals CMD or other terminals you have on your windows.

Customize windows PowerShell in windows terminal with Oh My Posh ❤️‍🔥

  1. Since we added the Acrylic effect and applied a compatible Caskaydia cove font. Next, install the Oh my Post prompt. To do that open terminal as administrator

2. Run the following command to install the Oh My Post prompt in the PowerShell window and Hit enter to allow the installation.

winget install JanDeDobbeleer.OhMyPosh -s winget

This installs a couple of things:

  • oh-my-posh.exe - Windows executable
  • themes - The latest Oh My Posh themes

Next, execute the below command to install the oh-my-push module.

Install-Module oh-my-posh -Scope CurrentUser

Type “Y” (Yes) to proceed.

Type “A” (Yes to all) to proceed.

3. Execute the following command to use the Oh my posh.

Set-PoshPrompt -Theme jandedobbeleer

Result.

4. Next, we have to make Oh My Posh default on our Windows PowerShell. To do that, execute the below command.

$Profile

5. Navigate to the file path or open the path using visual studio code.

If Microsoft.PowerShell_profile.ps1 file doesn’t exist in the Path. We have create it. In VS code click “new file”

Set a file name to Microsoft.PowerShell_profile.ps1

NOTE: .ps1 should be the file extension.

Set the file content using

Set-PoshPrompt -Theme jandedobbeleer

Now, whenever we open our PowerShell. the default theme would be Oh My Posh ❤️‍🔥

Customize WSL/Ubuntu in Windows Terminal with Oh My Posh ❤️‍🔥

  1. Open Windows Terminal with admin privileges.

2. Go to Settings > Select “Ubuntu” > Additional Settings “Appearance”

Set the following.

Font Face: CaskaydiaCove Nerd Font Mono

Background Opacity: 80% (set any opacity value you like)

Enable acrylic material: On

3. Select Ubuntu terminal (WSL or any other distro that you have installed).

3. Update Ubuntu terminal or WSL using the following command

sudo apt update && sudo apt upgrade -y

4. Execute the below command to install Oh My Posh in Ubuntu

## Install Oh my Posh
sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
sudo chmod +x /usr/local/bin/oh-my-posh

## Download the themes
mkdir ~/.poshthemes
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip
unzip ~/.poshthemes/themes.zip -d ~/.poshthemes
chmod u+rw ~/.poshthemes/*.json
rm ~/.poshthemes/themes.zip

5. Execute the below command to change your prompt

eval "$(oh-my-posh --init --shell bash --config ~/.{theme}.omp.json)"

OR

eval "$(oh-my-posh --init --shell bash --config ~/.poshthemes/jandedobbeleer.omp.jso

6. Now, to set Oh My Posh as your default prompt in Ubuntu, run the below command.

nano ~/.bashrc

7. In the Nano editor, scroll down using the keyboard arrow keys and look for this line “make less more friendly for non-text input files, see lesspipe(1)”. Right below it, you need to replace the command beginning with “eval…”.

8. Next, you have to type the below command in the Nano editor since it does not support copy and paste. It will look like this:

eval "$(oh-my-posh --init --shell bash --config ~/.{theme}.omp.json)"

OR

eval "$(oh-my-posh --init --shell bash --config ~/.poshthemes/jandedobbeleer.omp.jso

9. Next, press “Ctrl + O” and hit Enter to save the changes. Next, press “Ctrl + X” to exit the Nano editor.

10. Ultimately, execute the below command to reload the Bash profile. From now on, the WSL will load in the Oh My Posh prompt. Enjoy!

. ~/.bashrc

Author: Marc Kenneth Lomio | Senior Software Engineer | BlastAsia, Inc.

References:

--

--

Marc Kenneth Lomio & Melrose Mejidana

Software engineers that shares knowledge and experience through this medium.