Often when I show something in my terminal, people ask me, how do I make my prompt look like that? Well, the secret behind that is Powerline.

Step 1: Get the Terminal

Get a terminal that supports powerline and font-ligatures. If you're on Windows 10, you can download the Windows Terminal from the Microsoft Store. If you're already using the Windows Terminal, make sure you enable the font-ligatures within the settings.

If you're on Linux, you can use Konsole, which supports font-ligatures. You can install Konsole using the command sudo apt install konsole. After that enable font-ligatures within the settings.


Step 2: Install Git

Head over to this website and download Git for your Operating System.


Step 3: Get a PowerLine Glyphs supported font

Not all fonts support powerline glyphs and ligatures, and if you use any of those unsupported fonts, your powerline will look horrible. My personal favourite is Microsoft's Cascadia Code. You can download the font from here. Make sure you install the powerline version of the font, which has a filename: CascadiaCodePL.ttf
After that, set the font-face of your terminal to: "Cascadia Code PL"

If you want to try other fonts, you can go to Nerd Fonts and make sure you get / generate one that includes PowerLine Glyphs.


Step 4 (For PowerShell users): Install and Enable Powerline



Courtesy to the instructions given in this GitHub repository, install Posh-Git and Oh-My-Posh.
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Run these commands from PowerShell or PowerShell Core (in Linux). When you run Install-Module for the first time you'll get a warning that you're downloading and installing stuff from the internet so follow the prompts appropriately.

If you're using PowerShell Core, you also need to get PSReadline. Run the following command in PowerShell Core:
Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
Then run notepad $PROFILE and add the following lines at the end:
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox
That "Paradox" at the end is the name of a theme. You can choose your favourite theme from here.

If you want to hide your username@domain when not in a virtual machine, run notepad $PROFILE and add the following line at the top:
$DefaultUser = [System.Environment]::UserName

Step 4 (For Bash/ZSH users): Install and Enable Powerline



My favourite is Powerline-Go, specifically because of its speed and low latency. Courtesy to the instructions given in this GitHub repository, install Go and then Powerline-Go.
sudo apt install golang-go
go get -u github.com/justjanne/powerline-go
If you are using Bash, run nano ~/.bashrc and add the following lines at the end (you may already have a GOPATH so be aware!):
GOPATH=$HOME/go
function _update_ps1() {
    PS1="$($GOPATH/bin/powerline-go -error $? -cwd-max-depth 2 -hostname-only-if-ssh -modules venv,host,ssh,cwd,perms,git,hg,jobs,exit)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
    PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
If you are using ZSH, run nano ~/.zshrc and add the following lines at the end (you may already have a GOPATH so be aware!):
GOPATH=$HOME/go
function powerline_precmd() {
    PS1="$($GOPATH/bin/powerline-go -error $? -shell zsh -cwd-max-depth 2 -hostname-only-if-ssh -modules venv,host,ssh,cwd,perms,git,hg,jobs,exit)"
}

function install_powerline_precmd() {
  for s in "${precmd_functions[@]}"; do
    if [ "$s" = "powerline_precmd" ]; then
      return
    fi
  done
  precmd_functions+=(powerline_precmd)
}

if [ "$TERM" != "linux" ]; then
    install_powerline_precmd
fi
If you want to view your username@domain, delete the -hostname-only-if-ssh and add a module user before host int the PS1= line.