# Supercharge Your PowerShell: A Step-by-Step Guide to a Beautiful and Powerful Terminal

### Introduction

Are you tired of the bland, default PowerShell prompt? Do you dream of a terminal that's both visually appealing and highly functional? In this guide, I'll walk you through customizing your Windows Terminal and PowerShell to create a truly personalized and powerful command-line experience.

### Getting Started: Windows Terminal and PowerShell Core

First, ensure you have the necessary tools:

* **Windows Terminal**: It's a modern, fast, and highly customizable terminal application.  
    If you don’t have it already, you can get it from the following sources:
    
    * [Microsoft store](https://apps.microsoft.com/detail/9N0DX20HK701)
        
    * [Other ways of installing Windows Terminal - GitHub, Winget, Chocolatey and Scoop](https://github.com/microsoft/terminal?tab=readme-ov-file#installing-and-running-windows-terminal)
        
* **PowerShell**: For the best experience, use the latest cross-platform PowerShell Core.  
    You can get it from multiple sources.
    
    * [Using WinGet](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5#install-powershell-using-winget-recommended)
        
        ```powershell
        winget install --id Microsoft.PowerShell --source winget
        ```
        
    * [Microsoft Store](https://apps.microsoft.com/detail/9N0DX20HK701)
        

### Upgrade your Terminal/PowerShell fonts

A beautiful terminal starts with a great font, and Windows Terminal comes with a lovely font called Cascadia Code, a monospaced font from Microsoft designed for coding, but we will upgrade it to get more variant of this. Upgrading to the latest Cascadia Code release provides access to 'NF' (Nerd Fonts) variants, which include a wider range of glyphs and icons for enhanced terminal aesthetics.

* **Installing** [**Cascadia Code Font**](https://github.com/microsoft/cascadia-code/blob/main/README.md)
    
    1. Download the latest stable release of [Cascadia Code Font from GitHub](https://github.com/microsoft/cascadia-code/releases).
        
    2. Extract the downloaded archive.
        
    3. Navigate to the `ttf` folder.
        
    4. Select all the `.ttf` files at the root of the folder (not inside the static folder) and install them.
        
* **Updating the font in Windows Terminal**
    
    1. Open Terminal
        
    2. Go to the Terminal Settings
        
    3. Profiles → Default
        
    4. Additional Settings → Appearance → Font Face
        
    5. Choose the `Cascadia Code NF` and save.
        
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742119717080/b3a595b0-9c74-40f1-879a-3e49b63fc572.png align="center")
    

### Adding Icons with Terminal-Icons

Let's add some visual flair by displaying icons for files and folders.

* Open PowerShell (as administrator) and run:
    
    ```powershell
    Install-Module -Name Terminal-Icons -Repository PSGallery
    ```
    

Next, add the `Terminal-Icons` module to your PowerShell profile.

* Open your PowerShell profile with:
    
    ```powershell
    notepad $profile
    ```
    
* If the file doesn't exist, you can find the profile path using `echo $profile` and create the file manually.
    
* Add the following line to your profile:
    
    ```powershell
    Import-Module -Name Terminal-Icons
    ```
    
* Save the file and either restart your terminal or reload your profile with `.$profile`.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742120406289/94fc0d47-6fc1-429f-b62a-dade0572599c.png align="left")

### Beautifying Your Prompt with Oh-My-Posh

[Oh-My-Posh](https://ohmyposh.dev) is a powerful theming engine for your terminal. Oh-My-Posh allows you to customize your prompt with various themes and segments, including information about your Git status, current directory, and more. Segments are small pieces of information that can be added to your prompt, like the current time, or the state of your git repository.

* [Install Oh-My-Posh](https://ohmyposh.dev/docs/installation/windows) using Winget (or your preferred method):
    
    ```powershell
    winget install --id JanDeDobbeleer.OhMyPosh --source winget
    ```
    
* Customize your prompt with a theme.
    
    * Oh-My-Posh offers a wide range of [themes](https://ohmyposh.dev/docs/themes).
        
    * To use a theme, add the following line to your PowerShell profile, replacing `jandedobbeleer.omp.json` with your chosen theme:
        
        ```powershell
        oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\jandedobbeleer.omp.json" | Invoke-Expression
        ```
        
    * You can also create a custom theme by mixing and matching elements from different themes as well as adding any segments available for oh-my-posh.  
        Customized [theme](https://1drv.ms/u/c/72ffa50fc6101fef/ERtbvWEyfjBIhxH-ScRwpp0Be6jRP8L-MGCcms1BvfzdYQ?e=knlLCk) which I use.
        
    * Remember to replace the theme name with the one you want to use.
        
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742120887674/5230b237-c6e2-4851-bebb-43a0510c34d3.png align="center")
    

### Enhancing Command-Line Editing with PSReadLine

[PSReadLine](https://github.com/PowerShell/PSReadLine) provides a rich command-line editing experience. PSReadLine enhances command-line editing with features like command history search, tab completion, and predictive IntelliSense.

* PowerShell Core comes with PSReadLine pre-installed. If it's not present, install it with:
    
    ```powershell
    Install-Module -Name PSReadLine -Repository PSGallery -Force
    ```
    
* Add the following line to your PowerShell profile
    
    ```powershell
    Import-Module PSReadLine
    ```
    
* PSReadLine offers extensive customization options. Check out the [documentation](https://github.com/PowerShell/PSReadLine/blob/master/README.md) and [sample profile](https://github.com/PowerShell/PSReadLine/blob/master/PSReadLine/SamplePSReadLineProfile.ps1).
    
* This is the configuration which I use for PSReadLine
    
    ```powershell
    Import-Module PSReadLine
    
    Set-PSReadLineOption -EditMode Windows
    
    # Searching for commands with up/down arrow is really handy.
    Set-PSReadLineOption -PredictionSource History
    Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
    Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
    
    # The option "moves to end" is useful if you want the cursor at the end
    # of the line while cycling through history like it does w/o searching,
    # without that option, the cursor will remain at the position it was
    # when you used up arrow, which can be useful if you forget the exact
    # string you started the search on.
    Set-PSReadLineOption -HistorySearchCursorMovesToEnd
    
    # Instead of Inline suggestion (in grey) on search
    # if you like the suggestion in list which you can choose by up or down arrow
    # within the list, you can change the prediction view style
    Set-PSReadLineOption -PredictionViewStyle ListView
    
    Set-PSReadLineKeyHandler -Key Tab -Function Complete
    ```
    
* Your final [PowerShell profile](https://1drv.ms/u/c/72ffa50fc6101fef/EcAbC81beElKrgzQLJ62G1kBkMjv0T3c-nEQUL8i1ZCQmQ?e=mfF1Sk) may look like something like this:
    
    ```powershell
    # Include Terminal Icons
    Import-Module -Name Terminal-Icons
    
    # Include oh-my-posh theme
    oh-my-posh init pwsh --config "C:\WindowsTerminal-Powershell\oh-my-posh-theme.json" | Invoke-Expression
    
    Import-Module PSReadLine
    
    Set-PSReadLineOption -EditMode Windows
    
    # Searching for commands with up/down arrow is really handy.
    Set-PSReadLineOption -PredictionSource History
    Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
    Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
    
    # The option "moves to end" is useful if you want the cursor at the end
    # of the line while cycling through history like it does w/o searching,
    # without that option, the cursor will remain at the position it was
    # when you used up arrow, which can be useful if you forget the exact
    # string you started the search on.
    Set-PSReadLineOption -HistorySearchCursorMovesToEnd
    
    # Instead of Inline suggestion (in grey) on search
    # if you like the suggestion in list which you can choose by up or down arrow
    # within the list, you can change the prediction view style
    Set-PSReadLineOption -PredictionViewStyle ListView
    
    Set-PSReadLineKeyHandler -Key Tab -Function Complete
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1742121104529/7e3eea80-c9d6-48ab-96b4-27803cf9feb5.png align="center")
