Oh My Posh a beautiful prompt for your shell

Oh My Posh is a custom prompt engine for any shell that has the ability to adjust the prompt string with a function or variable. It’s beautiful, elegant and intuitive; if you use git from the command line it will be great for you, it has several predefined themes that allow you to customize your prompt in a matter of seconds, it is also possible to create your own theme, it is compatible with BASH, PowerShell, CMD, Fish, Zsh and nushell is developed in golang and can be installed on GNU/Linux, MacOS, Windows and Termux (Android).

Next we will install Oh My Posh on Debian GNU/Linux.

Step1: Download

With the following command we download the binary for GNU/Linux 64-bit architecture and save it under /usr/local/bin/oh-my-posh with the name 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

Step 2: Set exec perms

$ sudo chmod +x /usr/local/bin/oh-my-posh

Step 3: Dowload themes

Next we will download the predefined themes.

Step 3.1: Create DIR .poshthemes

For global use create the .poshthemes DIR inside /etc

$ mkdir ~/.poshthemes

Step 3.2: Download

$ wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O themes.zip

Step 3.3: Unzip

$ unzip themes.zip -d ~/.poshthemes

Step 3.4: Set perms

$ chmod u+rw,g+r ~/.poshthemes/*.json

In case you have created the .poshthemes DIR inside etc then run the following command:

$ sudo chmod u+rw,g+r,+r /usr/local/share/poshthemes/*.json

Step 3.5: Remove .zip

$ rm themes.zip

Step 4: Activate

Step 4.1: Create initialization script for BASH

$ oh-my-posh init bash --config .poshthemes/montys.omp.json > .oh-my-post-init.sh

With the above command we create all necessary initialization and save to .oh-my-post-init.sh, we selected montys theme.

For global move .oh-my-post-init.sh to /etc/profile.d (4.2, 4.3 are not necessary):

$ sudo mv -v .oh-my-post-init.sh /etc/profile.d/oh-my-post-init.sh

And source it:

$ source /etc/profile.d/oh-my-posh-init.sh

Step 4.2: Link the file on .bashrc

$ echo "source .oh-my-post-init.sh" >> .bashrc

Step 4.3: Source the init file

$ source .bashrc


YouTube video

1 thought on “Oh My Posh a beautiful prompt for your shell”

  1. Wrong spellings of oh-my-posh
    sudo mv -v .oh-my-post-init.sh /etc/profile.d/oh-my-post-init.sh
    also
    we need to write
    echo “source /etc/profile.d/.oh-my-post-init.sh” >> .bashrc

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.