Pimp Your Shell with Oh-My-Posh (Windows, WSL, Ubuntu, PowerShell)

Intro

Ever felt like your terminal was boring, looking like it was stuck in 1984? Or did those identical WSL boxes make you nuke the wrong OS by mistake ☠️? Don’t sweat it—Oh My Posh is here to save the day, give your terminal the glow-up it deserves, and bring some serious style to your shell game. Time to ditch your wack prompts and level up!🚀

🎨After a stupidly uninstalling vault from the wrong box this week, I decided to do a full revamp of all my lab terminals, and we think you’ll like those dope colors🔥on your terminal in this little tutorial 😉.

🧑🏼‍🚀What is Oh My Posh?

Oh My Posh is a powerful and customizable prompt theme engine for your terminal. It lets you transform your shell’s appearance with vibrant colors, icons, and themes, making it easier to navigate and personalize. Whether you’re using Bash, PowerShell, WSL, or any other shell, Oh My Posh brings clarity, style, and a consistent look across all your setups.

Features:

  • Colors: Enhance your terminal’s visuals with a full spectrum of colors.
  • Customizable: Tailor existing themes or create your own from scratch.
  • Portable: Keep your setup consistent across multiple machines and shells.

Getting Started: Installing Oh My Posh
WSL/Linux

1. Install

curl -s https://ohmyposh.dev/install.sh | bash -s

2. Install & select Nerd Font for Oh My Posh

Please check available previews

$  oh-my-posh font install
    Select font

  > 0xProto
    3270
    Agave
    AnonymousPro
    Arimo
    AurulentSansMono
    BigBlueTerminal
    BitstreamVeraSansMono

$  oh-my-posh font install meslo
    Successfully installed Meslo 🚀
    The following font families are now available for configuration:
      • MesloLGL Nerd Font ...

Once you have installed a Nerd Font, you will need to configure the Windows Terminal to use it. Modify Windows Terminal settings (CTRL + SHIFT + ,). In your settings.json file, add the font.face attribute under the defaults attribute in profiles:

{
    "profiles":
    {
        "defaults":
        {
            "font":
            {
                "face": "MesloLGM Nerd Font"
            }
        }
    }
}

3. Configure your shell to use Oh My Posh

  1. Select and download Oh my posh themes to ~/.config/themes
    My favorites ❤️‍🔥: M365Princess | cloud-native-azure.omp.json | iterm2.omp.json | jandedobbeleer.omp.json
    jtracey93.omp.json | remk.omp.json | dracula.omp.json
  2. Add oh-my-posh command to ~/.bashrc (or ~/.bash_profile):
eval "$(oh-my-posh init bash)"
  • Set a custom theme
eval "$(oh-my-posh init bash --config ~/.config/themes/M365Princess.omp.json)"
  • Once added, reload your profile for the changes to take effect.
exec bash

Windows

1. Install

Open a PowerShell prompt and run installation command :

PowerShell

Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient)

2. get the themes

the below command downloads all themes on your C:\Users\%user%\AppData\Local\Programs\oh-my-posh\themes\

 Get-PoshThemes

3. Configure your Powershell to use Oh My Posh

Adjust the Oh My Posh init line in your $PROFILE by adding the –config flag with the location of your configuration.

notepad $PROFILE
>>> add below line with accordig json theme file
oh-my-posh init pwsh --config /Mypath/jandedobbeleer.omp.json | Invoke-Expression

Once altered, reload your profile for the changes to take effect.

. $PROFILE

CMD

There’s no out-of-the-box support for Windows CMD when it comes to custom prompts. There is however a way to do it using Clink, which at the same time supercharges your cmd experience. Follow the installation instructions and make sure you select autostart.

1. Download clink

clink autorun install

2. Create a new file called oh-my-posh.lua in your Clink scripts directory

  • run clink info inside cmd to find that file’s location.
clink info | grep scripts
scripts          : C:\Program Files (x86)\clink ; C:\Users\%user%\AppData\Local\clink
  • Put any of the Oh my posh themes you like in either of the directories
  • Open Notepad and create a file named oh-my-posh.lua
load(io.popen('oh-my-posh init cmd'):read("*a"))()

You can also use a custom theme

load(io.popen('oh-my-posh init cmd --config C:/Users/Posh/jandedobbeleer.omp.json'):read("*a"))()

To set the configuration file, use the following command:

clink config prompt use oh-my-posh

Customization using clink

Clink has builtin support for Oh My Posh. It allows you to set the prompt using the clink command.

clink set ohmyposh.theme <path>
######### Example ##########
clink set ohmyposh.theme ~\oh-my-posh\themes\aliens.omp.json 


Conclusion (From Nada to PRADA)

With this tutorial, you’re now all set to glow-up your prompts in any shell like a true pro. I hope this one-stop guide helps you bring some serious style to your terminal, making your lab setups not just functional but fun! Plus, it should save you the hassle of wasting half a day scouring the web to piece it all together. Now, go rock those dope prompts!



Resources
Oh My Posh Official Site
Nerd Fonts Repository
Clink Documentation
https://windowsterminalthemes.dev/

Share this…

Don't miss a Bit!

Join countless others!
Sign up and get awesome cloud content straight to your inbox. 🚀

Start your Cloud journey with us today .