How to customize the windows terminal? Modify Powershell | Terminal| CMD | POSH GIT | OH MY POSH

How to customize the windows terminal? Modify Powershell | Terminal| CMD | POSH GIT | OH MY POSH

·

3 min read

As a developer, We have spent a lot of time in our terminals for getting something done. Wouldn't it be nice to have some customization, something which is a bit more of a personal taste? Well, today we will customize our terminal window to feel a bit more personal.

Step 0


What? we are developers, our first step always starts from 0. Well, as we are going to customize our terminal we need to download it first. 😐

Download Windows Terminal from the windows store or you can also get it from GitHub's releases, but I prefer getting it from windows Store for ease of use.

We will use POSH-Git and Oh-My-Posh, so make sure you have installed Git on your system. If not, then download now and install.


Step 1


After Terminal has been installed on your system. Now it is time to run some commands.

Now, fire up your Windows Terminal and run the following commands. When you run these commands, you may get some warning about downloading and installing stuff from the internet. So, follow those prompts appropriately.

With that in mind, now run these commands.

Install-Module posh-git -Scope CurrentUser

Install-Module oh-my-posh -Scope CurrentUser

These modules only get installed on their own system, but do not get configured automatically. So next we will configure these modules.


Step 2


Now, let's configure the profile of Powershell.

  • First
  • Check if the PowerShell profile exists or not by running the command.

echo $profile

If you get something like this:

C:\.......\Microsoft.PowerShell_profile.ps1

Then your profile already exists.

Now open the *.ps1 file in notepad or anywhen you can edit.

To open it via notepad from the terminal, run the command.

notepad $profile

Now copy these lines at the end of the file

Install-Module oh-my-posh -Scope AllUsers
Import-Module oh-my-posh
Set-PoshPrompt -Theme Paradox

The last line is to set the theme. Instead of 'Paradox', you can set your own preferred theme. see themes

With that done. The only remaining thing is the powerline-style fonts to support the terminal.

Now Let's move on to setting up the font and one final GOTCHA thing.


Step 3


If you do all this and you see squares and goofy symbols, it's likely that the font you're using doesn't have the advanced Powerline glyphs. Those glyphs are the ones that make this prompt look so cool. so we get the font next.

Cascadia Code has been updated with a PL (Powerline) Glyph version. You can get it here

After you have downloaded the font, install the ones with PL in their names.

Now go back to your terminal window, and just right side of the current tab you will see down facing arrow button. Click it and go to settings. This might open vscode or any text editor, but don't worry we have to change one line only. Look for fontFace in that file. if every this is default than you will find in line no. 29. Now replace that line with the following:

"fontFace": "Cascadia Code PL"

Save the changes and restart the terminal. After the restart, you might get an error. This is because by default you cannot run any scripts for security purposes, but how to enable it?

Well, close the terminal and open your terminal again but now in administrator mode, you will again see the same error here. After that run the following command.

Set-ExecutionPolicy Unrestricted

After this open a new tab from the + button beside the current tab and wallah! you got that.

If that worked. share your thought here.

Conclusion

You can change the startup theme at any time by modifying the PowerShell profile .ps1 file, in the last line where it says Set-Theme {themename} by setting it to Themes mention above.

Go To Official Website

Hope this helped you. Thank you, for your quality time.

Did you find this article valuable?

Support Apedu.co by becoming a sponsor. Any amount is appreciated!