Make Terminal Powerfull Using Oh-My-Posh
Programmers use a command-line interface (CLI) to issue text-commands to the Operating System (OS), instead of clicking on a Graphical User Interface (GUI). This is because command-line inerface is much more powerful and flexible than the graphical user interface.
The Terminal application is a command-line Interface (or shell). By default, the Terminal in Ubuntu and macOS runs the so-called bash shell, which supports a set of commands and utilities; and has its own programming language for writing shell scripts.
Oh My PoshOh My Posh is a custom prompt engine for any shell that has the ability to adjust the prompt string with a function or variable.
- Colors: Oh My Posh enables you to use the full color set of your terminal by using colors to define and render the prompt.
- Customizable: Easily adjust existing themes or create your own. From standard segments all the way to custom implementations.
- Portable: No matter which shell you’re using, or even how many, you can carry the configuration from one shell and/or machine to another for the same prompt everywhere you work.
powershell 7, download at Microsoft Store or install on official website.
oh-my-posh from winget.
or Manual installation
This installs a couple of things:
oh-my-posh.exe- Windows executable
themes- The latest Oh My Posh themes
zsh shell instead of
oh-my-posh by manual download.
nerd fonts from official website. And set
nerd fonts on terminal profile.
Create powershell user profile
We will be got an output
C:\Users\user\Documents\PowerShell\Microsoft.PowerShell_profile.ps1. This is our
$PROFILE location to be edited.
Create new file on
C:\Users\user\Documents\PowerShell\Microsoft.PowerShell_profile.ps1. For my device i like use
Add this below line on
.zshrc file to load
oh-my-posh theme engine. Because i use
WSL i can directly load from powershell at
/mnt/c/Users/Maverick/AppData/Local/Programs/oh-my-posh/themes directory. If not have themes yet can download first from GitHub here.
Usually i don’t like use
transient prompt so i need to remove this line.
source .zshrc or just close and reopen terminal. Oh My Posh already installed if looks like
Terminal-Icons Module to show if directory or files
z module, it can be used directly jump in some folder.
PSReadLine to auto suggestion or auto completion from history command line.
Update powershell profile
C:\Users\user\Documents\PowerShell\Microsoft.PowerShell_profile.ps1. I added function
which like on Linux command line to find where the program directory.
jump shell from
snap, on my case I use
Ubuntu-20.04. Jump integrates with your shell and learns about your navigational habits by keeping track of the directories you visit. It gives you the most visited directory for the shortest search term you type.
ruby gem and
colorls to beautify list directory.
.zshrc profile to load configuration.