Scott Hanselman

Making a better, somewhat prettier, but definitely more functional Windows Command Line

July 16, '13 Comments [58] Posted in Tools
Sponsored By
Running htop via ssh under ConEmu
 

I've blogged before, in fact in 2004, (!) that Windows is missing the text mode boat. There is a massive opportunity for a great, nay, awesome and pretty, command line on Windows. If someone cracks this problem, they're gonna be heroes.

I love iTerm2 and its tabs, its font handling, its simple elegance. I want this on Windows. In 2011 I found Console2, and then in 2012 I moved to ConEmu, a great tabbed terminal for Windows. Even then, it's not "pretty." I love these guys, and the ConEmu is truly an amazing and configurable piece of software, but it was written by developers for developers. I have to change the fonts to Consolas for the main font and Segoe UI for the rest to make it tolerable. Am I being petty and focusing on looks? Absolutely. Gorgeous and functional software is why Mac companies like Panic exist. They make things that are pretty AND functional. Windows folks could definitely "lovingly design" stuff more.

Here's some command line utilities that augment and help - but don't yet complete save - the Windows Command Line.

Clink

I just learned about Clink and I'm hooked. It's hooked as well, directly into your cmd.exe window! *rimshot*

We all know that there's Cygwin for a bash-like experience in Windows, but Click is a small utility that brings some of those productivity and editing features into cmd.exe directly!

  • Bash-like line editing from GNU's Readline library. Read more on Readline's keyboard shortcuts.
  • Better path completion (TAB).
  • Paste from clipboard (Ctrl-V). Oh yes.
  • Support for the completion of executables/commands, and environment variables.
  • Undo/Redo (Ctrl-_ or Ctrl-X, Ctrl-U)
  • Improved command line history.
    • Persists across sessions.
    • Searchable (Ctrl-R and Ctrl-S).
    • History expansion (e.g. !!, !, and !$).

The most significant change that Clink makes is to Tab Completion, moving to a more Bash-y "show them the choices" mode rather than the DOS-like "make them cycle through everything." Here I've pressed TAB over 2013-0 and Clink is showing me what I can choose from.

using Clink to make cmd.exe better

PowerShell ISE

Surprise! You already have this on your Windows computer. Ya, it freaked me out also. You can even hide the script pane if you want (Ctrl-R) and just use PowerShell ISE as a console! You get auto completion (see the Directory intellisense below), coloring, aliases and all the power of PowerShell.

Sure, it's not bash, but that may be a good thing. You may not have been exposed to PowerShell and the prospect may frighten you, but try it for a bit. They've aliased the obvious commands "ls" does what you'd expect as does "dir." Moving around will feel like any command prompt.

Not to mention if you are using PowerShell you already get a full debugger experience.

The PowerShell ISE

It won't win any awards for good looks (again, I come back to the importance of fonts, whitespace, and good typography...get a designer) but it is extremely functional and you already have it!

ConEmu lets you put your consoles in JumpLists!ConEmu

I've talked about ConEmu before, but I'll bring some of that over here. ConEmu takes your command prompt and adds tabs, status bar details, admin tabs, freakin' taskbar progress bars on copies (which is hot), and deep support for FarManager (Norton Commander anyone?)

Tabs in ConEmu in Windows

ConEmu is definitely a huge jump for console usability on Windows. The feature that really blew me away was Progress Bar integration. If you're familiar with Windows 7 you are likely familiar with the way that progress bars are overlaid over a Windows 7 Taskbar button. ConEmu looks at the current application running and some heuristics and overlays progress. Madness. Do a chkdsk and watch the progress bar. Love this little detail.

ConEmu Progress Bar

Git for Windows or Cygwin

If you want a Linux-like experience on Windows with a nice shell, Cygwin has long been a choice. However, since the release of Git for Windows most folks I know just install it and use the Git Bash. If you get Cygwin proper you'll get a much more complete "fake Linux" through their very competent set of command line tools, but for most, Git Bash will suffice.

Git Bash gets you close

What about SSHing? That's a fundamental part of command-line life for folks connecting to remote Unix machines. For me, I have a Linux farm I run on Azure that I often need to ssh into.

Random: I like to say I 'shoosh' into the machines, but folks keep looking at me weird. I thought this was a thing?

However, the SSH clients for Windows suck. Ok, they don't suck, but they are ugly. It's scandalous how ugly. Mad respect to PuTTY for being awesome and super functional, but it's like running Windows 95 in a window every time I launch it. Here's some better SSH clients, including a fork of PuTTY itself.

Bitvise SSH Client - more importantly, SSH from the command line

The Bitvise SSH Client is free for personal use and works great. There's a whole GUI, and, bless them, it's not pretty. However! There's also a command line version which is the REAL treasure. I just want to type ssh and be on my way.

In fact, I made a batch file called "ssh.bat" and put it in my PATH that just has this inside: "stermc %1" this means I can just type ssh user@hostname:port and be on my way. This is, for me, WAY easier than putty for most things. Bitcise is definitely worth checking out.

Find a SSH command line too like Bitvise

Kitty

Kitty is a fork of version 0.62 of the original PuTTY. There's also a portable version that I've put in my Dropbox utils folder (which is in my PATH) so it's on every machine I have automatically. Kitty has some nice features like Send to Tray, transparency, session launching (so you don't need Pageant), and lots of little poweruser features like "rolling up" the app if you Ctrl-Click on the Title Bar.

Kitty is a better PuTTY alternative

Kitty also can integrate into your browser to handle ssh:// links, which is a nice touch.

What console app improvers have I missed? What do you use on Windows? Sound off in the comments.


Sponsor: Big thanks to the folks at RedGate for sponsoring the feed this week. Take a moment and check out their free download of Deployment Manager! Easy release management: Deploy your .NET apps, services and SQL Server databases in a single, repeatable process with Red Gate’s Deployment Manager. There’s a free Starter edition, so get started now!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Tuesday, July 16, 2013 3:03:46 AM UTC
One I've recently found is MobaXTerm. It's Telnet, Putty, XMing, VNC, Remote Desktop, Cygwin, SCP and more all in one program. It's awesome, and free for personal use. Take a look!
Robert "Anaerin" Johnston
Tuesday, July 16, 2013 3:09:28 AM UTC
I'm surprised you didn't mention JPSoft's TakeCommand.
My TakeCommand setup starts two tcc.exe (JPSoft's cmd.exe replacement) tabs and two Powershell tabs.
The real power lies in tcc's extended functions and built in variables.
JPSoft offers both free and subscription versions.
Highly recommended.
CB
Tuesday, July 16, 2013 3:16:47 AM UTC
Putty has always been the gold standard of terminals, for me. Such a shame it's only a remote client and you can't use it as a local terminal.

I was thrilled to discover puttycyg, which allows you to use putty for your local cygwin terminal.
Tuesday, July 16, 2013 3:33:41 AM UTC
Thanks for enlightening me about Clink. Just installed it then. Painless and now I have usable tab completion!

However, I will still primarily use Cygwin for one feature that Clink nor Powershell ISE seem to provide...

Console output to the command window!

Whilst I love debugging in Visual Studio. Sometimes for performance / testing reasons a simple Console.WriteLine() output is the best (only) way to debug. And Cygwin seems to be the only way to access that output from what I've tried so far.

Anyone have any tips?
Tuesday, July 16, 2013 3:37:13 AM UTC
ConEmu is a real bear to configure and dial in, and suffers from a number of odd defaults, especially with key bindings. However, once it's dialed it's hard to beat -- especially since it's the only emulator I found that works well with ANSI escape sequences used by Ruby, Node and other command line tools. This is a pretty big deal for command line peeps who care about aesthetics.

Since there are so many dials and knobs, and it takes a while to figure out what they do and get it right, I built a Chocolatey package to get a nice ConEmu setup in place quickly. It will install Adobe's SourceCode Pro (IMHO, the best fixed width terminal / programming font around), and configures a nice clean Base16 color scheme.

It also sets up a PS Admin tab, a regular PS tab and a Git Bash tab.

More details can be found on the Chocolatey page -- http://chocolatey.org/packages/EthanBrown.ConEmuConfig

And of course, my package is open source, so feel free to fork and create your own variations.

Enjoy!
Ethan J. Brown
Tuesday, July 16, 2013 3:46:16 AM UTC
You should point out that PowerShell ISE 3.0 has a much better REPL-only view than PowerShell ISE 2.0. You need 3.0 for the "just give me the prompt" setup.
Tuesday, July 16, 2013 4:14:49 AM UTC
You're missing the grand-daddy of all command line extenders: 4DOS, it's NT progeny 4NT, and it's Windows progeny Take Command, from JP Software at jpsoft.com.
EvilKiru
Tuesday, July 16, 2013 4:20:29 AM UTC
What about Console2? I seem to remember learning about that from your blog.
Jim Lamb
Tuesday, July 16, 2013 4:31:57 AM UTC
Jim - Console2 development seems dead. I mentally replaced it with ConEmu.

Robert - Amazing find! I'm checking that out now!

CB - Good point, TakeCommand is an oldie but an actively developed ecosystem with a lot of fans!

Ethan - I love that you made your config a NuGet with cinst. Kudos.

EvilKiru - Dude, I was all about 4DOS back in the day.
Tuesday, July 16, 2013 4:47:58 AM UTC
Thanks for the tips, Scott!

I can only hope that as typography as a design principle takes off again -- thanks to the Metro UI -- that some Windows developers will apply the same principles to dealing with the command line. After all, the command line is the natural environment for text, numbers, tables, grids -- it should really be a delight to work there. It would also be great to see more IDE concepts like IntelliSense take root -- after all, you can do far more damage with a single typo at the command-line than you could in a file in Visual Studio, which will warn you about syntax errors, provide refactoring tools, code completion, etc., etc. I don't think the a command line IDE needs to go the WYSIWYG 'dark side' but it's strange that in 2013 it's such as Wild West environment, with little support and complete freedom to screw up your file system ...

Iian
Tuesday, July 16, 2013 5:19:17 AM UTC
Don't know if it's related, but I wrote about POSIX and windows here:

http://channel9.msdn.com/Forums/Coffeehouse/Is-Microsoft-risking-irrelevancy-bc-of-lack-of-POSIX-compitability

It even mentions your podcast with Paul Irish :-)
fanbaby
Tuesday, July 16, 2013 5:22:04 AM UTC
Minor typo in "We all know that there's Cygwin for a bash-like experience in Windows, but Click is a small utility that brings some of those productivity and editing features into cmd.exe directly!" should be Clink instead on "Click" after the but.
Tuesday, July 16, 2013 11:51:10 AM UTC
Is there any equivalent of "screen" in any of these envs/shells?
daboochmeister
Tuesday, July 16, 2013 3:03:12 PM UTC
The key for me would be a tool that is stand alone and small, something that I can drop onto a machine, use and clean up, without having to install/uninstall and still give the features needed. I am going to take a look at some of these, maybe one fits those needs.
Jerry Turner
Tuesday, July 16, 2013 4:03:22 PM UTC
Thanks for turning me on to ConEmu and clink! I can't believe I hadn't heard of them before now.

I use Linux hosts for a lot of my work, using PuTTY for SSH. I found a custom fork of PuTTY that uses Direct2D/DriectWrite. It supports Aero Glass if you are into that kind of thing (and I am), and many styles of transparency (e.g. background is transparent but text is not!).

Like you, I think that my workstation should be beautiful and functional (I look at it all day). Here is a screenshot of my shell setup and the custom variant of PuTTY.

You can download the fork of PuTTY (source included) here: http://ice.hotmint.com/putty/d2ddw.html. The author is from Japan, so you might want to fire up your favorite translator.
DAVe3283
Tuesday, July 16, 2013 4:07:36 PM UTC
I second Lionell's mention of <a href=<http://code.google.com/p/puttycyg/">Puttycyg</a>. I've found it to be the perfect solution to opening local cygwin terminal windows and ssh/telnet sessions to remote servers, all with 1-click access to the windows clipboard for copy/paste between windows.

And with different session profiles defined for local cygwin and various remote servers, I use a simple AutoHotKey script to setup keyboard shortcuts for easily starting the sessions. Ctrl-Alt-c opens a local cygwin session, Ctrl-Alt-d opens a session to server-D, etc.

Works great for me.
Tuesday, July 16, 2013 4:07:50 PM UTC
I like it... I'm going to start calling it "shooshing". I always thought SQL should be pronounced "squeel", but that never really caught on.
uglycoyote
Tuesday, July 16, 2013 4:23:17 PM UTC
ConEmu’s developers have just won a hundred internets for the overlay progress bars!

Thank you very much for this article, Scott!
Fitoschido
Tuesday, July 16, 2013 4:48:33 PM UTC
This discussion came up on Hacker News about a week ago.

Specifically, this thread requesting Windows terminal emulator recommendations.
Jed
Tuesday, July 16, 2013 4:56:34 PM UTC
It's possible to paste text from the clipboard to the command line using vanilla cmd.exe and only the keyboard. At the command line, press:

Alt+space, e, p.

Works in the default PowerShell window, too.

Not pretty, but I've been using it for years, and it's in muscle memory for me at this point!
Tuesday, July 16, 2013 4:56:43 PM UTC
There is a fork of Console 2, called ConsoleZ, with very active development and release : https://github.com/cbucher/console/
SA
Tuesday, July 16, 2013 5:26:08 PM UTC
"Random: I like to say I 'shoosh' into the machines, but folks keep looking at me weird. I thought this was a thing?"

If it's not a thing, I'll do my part to spread it. From now on I will refer to it as 'shoosh'-ing :-)
Pete Tirrell
Tuesday, July 16, 2013 6:03:52 PM UTC
ConEmu + GOW (Gow - The lightweight alternative to Cygwin) + TCCLE + git bash covers everything for me.

Tuesday, July 16, 2013 10:36:54 PM UTC
Looks good. Do they also send your command line history to the NSA as a hidden side feature?
Jim
Wednesday, July 17, 2013 1:45:12 AM UTC
I'd also like to big up Gow. It adds all the usual unix command line tools (grep, sed, awk etc) into the regular cmd console without all the bloat of Cygwin. Use it on a daily basis.
Craig Porter
Wednesday, July 17, 2013 1:50:47 AM UTC
With all these great options, it almost seems like there will be a big section about command line options on an updated http://hanselman.com/tools list. It seems about time for an update of that list since it sounds like C:\Utils has been replaced by Dropbox.
Wednesday, July 17, 2013 6:41:52 AM UTC
I'm surprised that nobody mentioned Total Commander.
tzup
Wednesday, July 17, 2013 8:24:27 AM UTC
Prepare ... you are on reddit's front page :D
Wednesday, July 17, 2013 11:19:08 AM UTC
Hey Scott, try gow
https://github.com/bmatzelle/gow/wiki
Wednesday, July 17, 2013 1:30:50 PM UTC
I think you forgot two key features: multiline cut and paste, and the ability to resize the window (without going through a config dialog). The only terminal I found that does that right is Cygwin's rxvt.
Frank Seide
Wednesday, July 17, 2013 1:44:41 PM UTC
Thanks for this!
Joao
Wednesday, July 17, 2013 1:55:52 PM UTC
If you haven't seen or tried Xiki (executable wiki) yet, prepare to have your mind blown. It's a shell console where everything is editable. Just watch the first screencast to see what I mean. http://xiki.org/screencasts/ (No, I am not affiliated with the project at all, it just rocks THAT much)
Wednesday, July 17, 2013 2:14:24 PM UTC
... and I should have mentioned that Xiki currently does not work on Windows :'(, but support for Windows is planned.
Wednesday, July 17, 2013 2:50:26 PM UTC
"Random: I like to say I 'shoosh' into the machines, but folks keep looking at me weird. I thought this was a thing?"

I was saying 'shish'-ing occasionally but I like your 'shoosh'-ing much better. Thanks!
Wednesday, July 17, 2013 3:27:22 PM UTC
I mean, this is somewhat "oldschool" - but i really like the powershell :-)

Wednesday, July 17, 2013 4:21:52 PM UTC
Git for Windows also includes SSH client that works very well.
Alok
Wednesday, July 17, 2013 4:34:06 PM UTC
After reading your previous posts about Console2/ConEmu I switched over to ConEmu as well. I am loving it. You can integrate putty straight into ConEmu easily so you can just fire up a putty tab vs. cmd tab.

As for ssh.exe - I did not have to install anything more than the Git for Windows (and add the C:\Program Files (x86)\Git\bin directory to my PATH) to get ssh functionality in my cmd prompt.

When it comes to development environments, you should glance at Vagrant (http://vagrantup.com) as well - they support Windows environments - you can create virtualbox images of your server environment and spin them up at will with configurations for individual projects, etc. Works great in conjunction with ConEmu.
Ben Evans
Wednesday, July 17, 2013 5:47:59 PM UTC
What is that top-like program you're using in the first screenshot?
Mike
Wednesday, July 17, 2013 5:58:02 PM UTC
PowerShell doesn't support ls -lrt
Jim
Wednesday, July 17, 2013 7:53:12 PM UTC
@Mike - that looks like htop
Justin Pitts
Wednesday, July 17, 2013 9:37:16 PM UTC
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
Mike
Thursday, July 18, 2013 12:21:48 AM UTC
Very cool article article! I am not familiar with the Bitwise ssh client, but my favorite ssh client on windows is this obscure port of OpenSSH v5.6 (available for download here). It is cygwin-based but installs cleanly as a standalone and works great with ConEmu. It is a much newer version than the ssh that comes with git's mingw environment (that old version has caused problems for me in the past) and also includes scp. These tools are as close to being 100% command switch compatible with their official versions as it gets on windows. After I install it I add it to windows's path and git bash's path (delete their outdated version!) and everything works like a charm. Well, almost, if _might_ need to do this workaround to suppress cygwin's annoying dos file path warnings. My 2 cents!
Thursday, July 18, 2013 3:04:19 PM UTC
Hopefully Clink supports setting editing-mode to vi, since its readline underneath
Jay
Thursday, July 18, 2013 3:50:03 PM UTC
@Jay - It does! Everything Readline can do works in Clink. Ctrl-Alt-J or add "set editing-mode vi" to you clink_inputrc to enable vi edit mode.
Monday, July 22, 2013 1:37:42 PM UTC
There is a nice scriptable tabbed SSH client called Poderosa developed in Japan.
It uses javascript as the scripting language, and you can automate a lot of stuff.

Really nice
Monday, July 22, 2013 9:16:24 PM UTC
Console2 ftw. ConEmu is the most bloated terminal I've ever tried.
yu
Tuesday, July 23, 2013 4:48:27 AM UTC
ConsoleZ currently wins over ConEmu, with respect to key bindable split pane navigation. ConsoleZ allows for direct adjacent jumps and ConEmu is more of a cycle through. Neither provide pane resizing.
Tuesday, July 23, 2013 6:20:06 AM UTC
I know it's not a windows app.. but I would LOVE if it were.. There's an application called TotalTerminal that adds a terminal (console) "visor" to your system. Remember the old console visor from the Quake series? Hit ctrl-` and you get a dropdown console visor. Wish I could have it on Windows. :)
DWAK
Tuesday, July 23, 2013 12:19:06 PM UTC
Wish seemed promising, but I'm not sure of the status and it looks like funding was unsuccessful.
Andrew
Thursday, July 25, 2013 3:49:04 PM UTC
In fact, I made a batch file called "ssh.bat" and put it in my PATH that just has this inside: "stermc %1"


You could have created a ssh.bat that did putty -ssh %1 just as easily. Presumably Kitty supports this syntax as well.

This syntax is in the PuTTY Help File under PuTTY FAQ -> HOWTO Questions... which also covers loading a saved session from the command line, which is handy for those you have certificates for.
Ross Bemrose
Thursday, July 25, 2013 7:30:02 PM UTC
+1 for MobaXterm. It incorporates everything into one sleek, easy and fun to use experience.
Friday, July 26, 2013 7:33:47 AM UTC
BTW, ConEmu build 130725 provides split resizing and jumping between panes in visual direction with keyboard shortcuts.
Saturday, July 27, 2013 10:40:42 PM UTC
PowerTab extension may be very useful for powershell users.
It brings intellisense to console version of powershell and to ConEmu of course ;)
Screenshot 1, screenshot 2.
Sunday, July 28, 2013 2:34:14 AM UTC
Powershell ISE is really great until you run "net use" or "sqlcmd" and it tries to prompt for a password, but can't.
Brianary
Friday, August 02, 2013 12:06:38 AM UTC
Best post ever, or best post ever. cmd.exe is the bane of my Windows-using experience. I was shocked to see `htop` running in Windows decorations!
Tuesday, August 27, 2013 1:07:34 PM UTC
Just to add my tuppence worth.

What about the GnuWin32 collection?

http://gnuwin32.sourceforge.net/

One of the first things I do on a new build is pretty much install everything here, and off the bat that gives me a full POSIX compliant command line environment where things like awk, sed, diff, grep and more just work exactly the same as I'm used to on *nix.

Most of the utils don't require the cygwin runtimes either as a lot of them are natively compiled against the required win32 subsystems.

All of them just run from cmd.exe and can be piped together using | in exactly the same way most are used too.

There are a few quirks with the handling of speech marks (") , but that's due mainly to cmd not handling double and single as transparently as bash and others do. Install all of these however, then use git bash (as previously mentioned) and it's win all the way.
Friday, September 27, 2013 2:18:47 PM UTC
Brilliant information. I've just blogged about my own command prompt setup on windows here : http://matt-roberts.me/development/console-awesome/

Basically, I use console2 (although I will check out ConEnu), and PyCmd for all the awesome I need.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.