Microsoft Build 2019 has just finished and some very exciting announcements were made among some of them is the new Windows Terminal which is described as:

a new, modern, fast, efficient, powerful, and productive terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and WSL.

They even created a video that is quite the marketing effort and I have to admit it, it's looking quite nice.


You can see the presentation at Microsoft Build here: Windows Terminal: Building a better command line experience for developers and you can see more details on this blog post: Introducing Windows Terminal

Too little too late?

There is no doubt about too late because we know we haven't had a decent built-in terminal in windows, all we had is the Windows command prompt which is already ~30 years old and while it does it works it's not a tool where you want to spend your time in. The team working on it have added some basic improvements to it but is still a long way from most terminals especially the ones available on UNIX systems and we certainly can not customized as it is possible on UNIX and if you have used something like oh my zsh you will know cmd it just miles away from that but is this new terminal too little? We will know for sure once it fully released in around June.

You also have Powershell as an option and even tho it has been the favorite for many Windows SysAdmins for developers is not that great, why hasn't this be a priority for Microsoft? Well... I can't tell for sure but on the past Dotnet developers have been mostly using IDE(Visual Studio) for development and you normally had eveything you needed there.

Do we need a good console application on Windows?

With so many popular development tools that exist today that normally requires a CLI to work the need for a good console is clear even dotnet core has moved to use more and more CLI tools and while you can integrate all of this directly into Visual Studio so that those scripts will be run automatically when you build or execute your solution from Visual Studio, the truth is many people is shifting away from the big IDE experience and using more lightweights editors such as Visual Studio Code and terminal commands and if you are doing Development in other languages such as python, javascript or ruby you cannot escape the need for a better console.

Such was my case when I started doing Django development, coming mostly from a DotNet background I opted to stay on Windows to do Django development everything was going well except for cmd I was doing my pip installs, creating virtual environments, generating and running migrations and even running the application on the console and cmd was just not good enough. So I set myself to find a decent console for Windows that would provide me a better experience.

Console application available for Windows

If you do a google search for alternatives on Windows you will find many options available for you, and one that you probably already have is you are a software developer is git bash which is normally included on the Git installer for Windows and no doubt it' a great improvement it allows you to execute Unix style commands it also provides you with commands such as ssh, scp, cat, etc and in addition, it has great auto-complete for git commands however there are a few things that are missing.

  1. 1. Tabs and Split Views
  2. 2. Better keyboard shortcuts support
  3. 3. Better looks and more customizable options

So what choices do we have? actually, a lot since many people have felt the need for a better console application in Windows, just to mention a few Taken from Slant.co

cmder-must-have-windows-console
You can read the reviews on the link to Slant if you want to see more for yourself

My pick

I'm in an agreement with results in Slant since I also went for cmder -- pronounced “Commander” it provides exactly what I wanted, I really like the default styles and if you don't you can customize it, it also provides great split views and great keyboard shortcuts

Tabs and Split Views

cmder-must-have-windows-console

Great keyboard shorcuts

cmder-keyboart-shortcuts

Highly customizable

cmder-settings

You can read more about cmder here Wiki and here About cmder but I will give you a very brief overview of some of the features I use the most

Unix Style Commands

These are actually a gift from git for Windows and not cmder itself however cmder can take advantages of them and use them and if case you are new to the console world on Windows I want you to be aware of the goodies available
  • ls to list the folders and file names in the current working directory and you can actually use the variety of flags available
    cmder-ls
  • touch have you ever tried to create a .someName file on Windows? it could be troublesome but you can use touch for quickly create empty files and update the modification date on existent files eg: touch .editorconfig
  • cat to concatenate and quickly check the contents of a file directly on the console.
    cmder-cat
  • rm for deleting files and folder use it with -r to recursively delete subfolders and -f to force my most typical use for this is rm -rf node_modules 😅
  • ssh, ssh-keygen and ssh-add For accessing remote servers, the lack of using ssh as I was able to use it on Linux is probably the biggest reason I have cursed Windows, having to deal with PuTTY and it's utilities was a nightmare to me in comparison with using ssh on Linux, and to my surprise many people still think PuTTY is the only way to use ssh on Windows, but we actually have two ways to use ssh just like on Linux now, one that comes with git for Windows an open ssh client that now comes built in on Windows 10 so Putty is no longer your only option if you need to ssh into a server. If you want to check which ones you have available you can use the where and which commands
    cmder-ssh
    As you can see I have both options available but I'm using the open ssh client that comes in Windows 10

Keyboard shortcuts

  • Ctrl + t you are probably already familiar with this short cut since it's used to open a new tab on browsers and on cmder it does exactly the same so it is easy to get used to it.
  • Ctrl + w close the current tab
  • Alt + Enter Full screen
  • Ctrl + Alt + u Same as typing cd .. and hitting enter on the console it allows you to quickly traverse up in the directory structure
  • Ctrl + r Have you ever typed and execute any command with so many parameters that is hard to remember and you didn't save it? this shortcut has saved me many times since it allows you to do a reverse search
    cmder-search

Copy & Paste

  • Copy just select/highlight the text that you would like to copy and you have copied the selected text
  • Paste you can simply right click to paste the text on the clipboard or use Ctrl + shift + v

Git

  • Git auto complete just type something like git co and hit tab and it will autocomplete git commit for you it can even suggest commands for you when there is more than one autocomplete options try something like git che then hit tab twice and you will see something like:
    cmder-git-autocomplete
  • Git info right there on the console
    cmder-git

Aliases

This is probably the feature I love the most because of much it has increased my productivity and how simple it is to use it. The following is a list of a few commands that I've used pretty much on a daily basis.
  • python manage.py runserver
  • python manage.py makemigrations
  • python manage.py migrate
  • dotnet run
  • cd source/repos/somerepo
  • rm -rf node_module && npm install
  • git fetch && git checkout somebranch
  • git commit -m "my commit comment"

You can see some of them are a bit long with Alias I can create shorthands for all of these and it's as simple as alias djrun=python manage.py runserver where djrun is the alias you would like to use for me is dj from Django and run of running the server so now I can just type djrun which it's a lot less typing than python manage.py runserver and you even get autocomplete for your aliases too.

cmder-alias-django-run

I can do similar things for my other commands, one that I find very helpful is creating an alias my accessing my repositories eg: alias gotopesite=cd C:\Users\LuisPalacios\source\repos\personal-site this way no matter where I'm in my directory structure I can just type gotopesite hit enter and I'll be immediately in my repository.

cmder-alias-navigation

What about when you need an alias that supports an argument such as git commit -m "this should be an argument" you can easily accomplish that using $* wherever you want your alias to receive an argument so in my case it can be something like this alias gtcommit=git commit -m "$*" and then I can use it like this: gtcommit this my example comment

cmder-alias-git-commit

There is a lot more you can do with alias and you can find more details on the official docs in cmder on the links I shared but hopefully this is enough to get you started.

Startup Tasks

This one also helps a lot with productivity, because you can create your own custom startup task, let's take a look at what I normally need to do when working on my personal site which is build on Dotnet Core but it also uses Nodejs tools for building the front-end such as Webpack.

  1. 1. A command line tab for handling my git commands
  2. 2. A command line running my site dotnet run
  3. 3. A command line watching and building my front-end files npm run watch

Not to mention, I need to navigate to my repository directory in order to run these commands, so the manual steps I would need to do every time I want to work on my personal site would look like the following:

  1. 1. Open cmder and navigate to my repository directory
    open-cmder
  2. 2. Open a new split tab to the right, navigate to my repository and run dotnet run
    cmder-open-tab-right
    cmder-run-dotnerun
  3. 3. Open a new split tab to the bottom, navigate to my repository and run npm run watch
    cmder-open-tab-bottom
    cmder-run-npmwatch

That is a lot of repetitive work, even using aliases is still annoying, cmder has an option like internet browsers that you can save and re-open all the same tabs you had every time you close and open cmder.

cmder-autorestore-tab

That might be everything you need if you only work in a repository, but if you are like me and you need to work on multiple repositories through the day this isn't that good because if you try to keep open all the tabs for all the repository that you need, the navigation through the tabs becomes more difficult not to mention you would be wasting precious RAM.

So it would be great if I can just tell cmder "Open everything I need to work on my Personal Site" that is exactly what I can do trough Startup tasks, I'm going to define my own custom Startup task to work on my personal site

  1. 1. Open cmder and go to settings Win + alt + p then go to Startup -> Tasks and click the "+" button.
    cmder-add-newtask
  2. 2. Now we need to tell cmder exactly what we want our task to do, there is a lot we can do here you can see more about it here ConEmu’s Tasks however this can be overwhelming if you are new to this console emulator world, cmder has an awesome feature that pretty much allows us to tell it "Save my current tabs as a new task" so all we need to do is define whatever name you want to identify your task and click on Active tabs.
    cmder-add-newtask-name
  3. 3. This will create a task that will open all of the tabs I need on with the split views I have defined and on the directory where I need them, however, it won't run any command when is started but adding that is pretty simple I just append at the end of each command && mycommand and I also need to define task parameter which in my case I just copy and paste from the task cmd::Cmder. Make sure you click Save Settings.
    cmder-add-newtask-config
  4. 4. Now whenever I open cmder I can ctrl + t to open a new tab and you will see that my new task is listed there and if I selected it, it should open all the tabs and run the commands that I want in order to work on my personal site repository
    cmder-start-newtask
    cmder-ready-togo

That is a great improvement however, we can take it one step further, I can actually pin my new task to the windows taskbar. I've already had my cmder pinned to my taskbar but if I right click it all I see is the option to open cmder or unpin it from the task bar.

cmder-taskbar-default

In order to add the new task to the taskbar we need to follow the next steps.

  1. 1. Open settings and go select your task and make sure the checkbox Taskbar Jump list is active, you can also go through the task list and remove this check for the task that you don't want to appear on the taskbar
    cmder-add-newtask-taskbar
  2. 2. On the settings windows go to General -> Taskbar and make sure the checkboxes Add ComEmu Task and AutoUpdate are active then click the Update now button and then save settings
    cmder-taskbar-update
  3. 3. Now for our last step, execute the command ConEmu.exe /updatejumplist on a cmder tab.
    cmder-taskbar-complete

With this, I'm ready to open everything I need on my command line in order to work on my Personal Site repository with just a right click and a click

cmder-taskbar-ready

Is there a catch?

cmder just like many other options for a better console on Windows is an emulator so this mean performance could be affected, on older versions, I did notice the startup time was slower than starting cmd or PowerShell but I also had older hardware, now that I have better hardware (i7 and SSD) I don't notice any performance problems.

What do you think? are you excited about the new Windows Terminal? do you think cmder is a great option while we wait for it? What have you been using as your go-to console on Windows? let me know in the comments below.