Windows Terminal: Changing the Default Shell

Every time I open the new Windows Terminal, which I am extremely excited about, by default it opens a PowerShell window. As you probably figured, I am no Windows or Help Desk admin (or at least as of 15 years ago, anyways).

Although I do sometimes do have to use PowerShell to enable one Windows feature or another, Ubuntu WSL is where I ply my trade most of my waking hours. So it would make sense that whenever I opened Windows Terminal, it would open a new Ubuntu WSL session.

If you haven’t installed Windows Terminal yet, you can get it from Microsoft’s Window Store (for free). You may or may not need to be running on an edge release of Windows 10.

If you want to contribute to the development of the Windows Terminal, make sure to check out their repository over at Github.

When you open Windows Terminal, open the Settings:

Open Settings in Windows Terminal

That should open a Notepad.exe window with Windows Terminal settings:

Notice the defaultProfile field at the top: it contains a UUID, or unique identifier. As does each entry under the profiles section.

In my case, the UUID 61c54bbd.. corresponds to the powershell.exe profile.

I am going to change that to c6eaf9f4–32a7…, which corresponds to my Ubuntu WSL profile:

And just like that, next time I open Windows Terminal for the first time, it should open an Ubuntu WSL session instead of PowerShell.

Credit: https://superuser.com/questions/1456511/is-there-a-way-to-change-the-default-shell-in-windows-terminal

.

Customize All The Things

.

Introducing Windows Terminal, by Kayla Cinnamon over at the Windows Command Line development blog (May 6, 2019) contains more details on things you can do with your Windows Terminal.

Go do and check out Kayla’s set of of blog entries, as well as the rest of written by Microsoft’s Command Line team to stay updated about new Windows Terminal features and releases!

If you want to personalize the terminal’s background image or opacity, check out How to change the Windows Terminal background image by Thomas Maurer (September 14, 2019).

Here’s my settings:

Opacity, background image, windows env variables

Regarding changing the background image, there’s two things that I noted:

  1. I was not able to apply a global background image and transparency setting (for all terminals). Instead, I had to apply it individually to my WSL profiles. That’s OK with, because it works.
  2. You CAN use Windows environment variables when specifying the path to your custom background image. Provides for a more flexible setup and a less PII-leaky screenshots (pasted below).

.

Here’s is the end result:

If you’re curious what I’m using for background, it’s from NASA’s image of the day gallery, which supplies with super high resolution images free of us (they’re taxpayer funded, after all):

What if I want to modify the default cmd.exe ?

.

The default cmd.exe shell is invoked like so by Windows Terminal:

"commandline": "cmd.exe",

While in the cmd shell, if you type /? it shows you a list of things that you can do when invoking the shell.

In addition, the prompt command documentation provides further list of options that you can use to customize your prompt.

By chaining the invocation options provided by cmd.exe with the options provided by prompt, you can fully customize what is shown in your command prompt when you open it.

In my case using the following setting for the Windows Terminal:

{
// Make changes here to the cmd.exe profile
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe /K prompt $d$s$t$_@callback.insanity$s$l3$g$s",
"hidden": false,
"startingDirectory" : "%USERPROFILE%/Sites",
"backgroundImage": "%USERPROFILE%/Pictures/win95-1.jpg",
"useAcrylic" : true,
"acrylicOpacity" : 0.7,
"backgroundImageOpacity" : 0.4
},

Yields the following result:

Retro style Windows 95 background !!!

The /K cmd.exe parameter tells the shell to execute the following command without terminating the shell. And by passing prompt to /K I can fully customize the appearance of my prompt.

No more pesky PII (such as your username) being shown on the prompt when I post screenshots of my prompt on my stories, along with some nice swag to go with it.

Organic, fair-sourced DevOps and Full-Stack things. This is a BYOB Establishment — Bring Your Own hipster Beard.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store