Windows Command Line Tweaks
As a developer, you often work in a terminal.
If you come from Linux or Mac to Windows and open a Powershell terminal, the first experience is unpleasant. Of course. You may have spent years on your terminal of choice on Linux or Mac, and you know how to configure it.
But what now: On Windows, on a fresh installation, and the first time you open the Powershell?
No worries. With a few steps, life on Windows can also become more terminal-friendly. Here is a first door opener that should motivate you to not give up too early and get you going.
Prerequisite
For a decent experience, use the following tools.
Windows Terminal
There is a Powershell terminal that works and looks basically like the cmd.exe
.
It’s not the best choice.
Make the Windows Terminal your default terminal. It is a great tool and has a lot of features. You can download it from the Microsoft Store.
Explore the Windows Terminal like you would do it with any other new software. It has lots of configuration and customization options. And you can pretty much adapt it to your needs.
Scoop.sh
Scoop is a package manager that allows you to install and manage the software you miss on Windows.
Fonts
A shell needs proper fonts to display everything correctly.
You can either download and install the fonts manually or use scoop to install them.
Manually: go to https://www.nerdfonts.com/font-downloads and download the fonts you like. Extract the zip file and install the fonts by selecting them, right click and then click the install option.
Or, use scoop to installed the fonts.
scoop bucket add nerd-fonts
scoop install Cascadia-Code
In the Windows Terminal, go to Settings, Profile/Defaults, Appearance and select the font you want to use.
Tweaks
Now, with the right tools in place, we can start to tweak the Powershell.
PSReadLine
PSReadLine brings autocompletion, syntax highlighting, Ctr+R search, and more to the Powershell.
PSReadLine can be installed with scoop.
scoop install psreadline
Posh-Git
Posh-Git is a tool to display the current git branch and some more information in the prompt. It is even mentioned in the Git Book.
scoop install posh-git
An all-in-one solution
If wanted, you can also follow Microsoft’s own custom-prompt-setup tutorial, which will point to oh-my-posh.
It’s a good tutorial. I prefer more control over the terminal configuration. For me, oh-my-posh does a little bit too much. Especially when new to the terminal, it’s easier to understand what is going on by adding features self, and step by step. The learning experience is also better.
But if wanted, oh-my-posh can be installed with scoop.
Summary
A lot can be done with Windows Powershell to make it a decent terminal. The Powershell has one interesting feature: It’s available on all 3 major operating systems.
That makes it appealing to some people who want to have the same terminal experience on all platforms. But even if this is not wanted, the Powershell can be a good choice on Windows, and with a few teaks, it can be polished to a decent terminal experience.