

Making a better, prettier, more functional Windows Command Line - smacktoward
http://www.hanselman.com/blog/MakingABetterSomewhatPrettierButDefinitelyMoreFunctionalWindowsCommandLine.aspx

======
yogo
Windows has indeed missed the text-mode boat big time. Eventually I think
people naturally gravitate to running Linux with Windows in a virtual machine.
I remember trying many of the tools mentioned in the article and it always
never quite felt right. A lot of the _niceness_ could be attributed to a
combination of bash, readline, and the accompanying *nix tools--the experience
just isn't the same in Windows. Having terminals open in front of you in
something like terminator is simply a joy in Linux.

~~~
ericcholis
I think this lends heavily into the reasons why development on OSX has become
so popular. Devs were dying for a functionally attractive alternative to
Linux, but Windows didn't offer the proper environment.

Heck, as a primary Windows user I've been contemplating switching to OSX for
development.

P.S. While Cygwin is nice, I've always felt like it was a clunky alternative
that was shoe-horned into Windows.

~~~
barrkel
Cygwin is my primary means of interfacing with Windows, and combined with a
bunch of shim scripts I've built up over the years, I get a very similar
experience across Windows, Linux, OS X and Solaris.

I actually prefer a Cygwin terminal on Windows to a Rxvt or similar
lightweight terminal in X Window. The biggest pain in Linux is the selection
buffer. With Console2 on Windows, selecting text puts it in the clipboard
buffer, and you can then select a bunch of text in your IDE and overwrite it
with a paste. The same workflow doesn't work at all well in Linux; first you
must delete the text in the IDE, then select the text in the console, then
very carefully aim where you want the text inserted and fire with the middle
mouse button.

Even worse, IDEs like RubyMine clobber the selection buffer for common
operations like Ctrl+Shift+N (Navigate | File); not only does it clobber the
buffer, but it hides the window if it loses focus, so it's actually impossible
to copy text from an rxvt terminal into its search box!

As a practical web development environment, I think Linux is the way to go to
minimize the distance to production. But my preferred means of interacting
with Linux is ssh, either to a VM or over the network, from a nicer desktop
OS. Which for me is Windows.

~~~
WayneDB
> Cygwin is my primary means of interfacing with Windows...

Could you explain that a little more? For instance - say you want to browse
the web or read email - you're doing it in a Cygwin terminal?

Do you use it as your launcher to launch Windows apps or do you only run text
interface applications? Or, do you just do most of your dev/sysadmin work in
Cygwin and use normal Windows apps for the rest?

~~~
barrkel
I mean I have 7 terminals (many also running screen) open on my desktop - more
windows than all other apps combined; and almost all interaction with the OS,
by which I mostly mean process and file management, is via the command line.
My browser is relegated to a secondary window alongside my service monitoring
and ssh terminals.

When I write new utilities, they are usually command-line based. If I can get
away with it, I'll put together a bash script built out of pipelines of Unix
utilities and various others I've written over the years. I'm reluctant to
write for-purpose apps; I try to make them fit into a Unix-style paradigm of
streams combined with some command-line options.

For example, I recently wrote a simple video editor to select clips from my
motorbike commuting videos. The only platform-specific bit is the video
player, and all it does is respond to keyboard commands to navigate backwards
and forwards and mark positions, in response to which it writes out text to
standard out. I have other scripts which drive ffmpeg or other utilities as
necessary to do the heavy lifting of cutting and composing. And to port it to
another OS, all I need write anew is a video-playing component. And things
like parallelization for efficiency, process isolation for resilience, and job
control to temporarily reduce CPU usage (perhaps to avoid overheating on
reencode!) are trivial.

For work, all my testing is done from the command-line, much of the code
tweaks, all source control, merge resolution, grep / sed / etc. Debugging is
usually done with repls like pry for Ruby. Browser at work is primarily used
for distraction while having a coffee and waiting for tests to run, or to
interact with company web apps.

Things like web browsers (Firefox in my case, because of tree-style tabs more
than anything else) are invariant across platforms. If you live entirely in
the browser, you don't need to deal with, or even know anything about, the
machine's OS. So I don't really consider that use case an interaction.

~~~
WayneDB
Wow, that's impressive! I just couldn't imagine working that way, so thanks
for clarifying.

------
ckozlowski
I had the impression that cmd.exe was on its way out, soon to be replaced by
Powershell entirely.

When I saw the option for Powershell to open by default in Windows 8/2012
instead of cmd.exe, I figured the writing was on the wall.

~~~
forgottenpass
Powershell still uses the same terrible terminal emulator that cmd.exe does.
This article is mostly about terminal emulators, and using windows shells for
unixy stuff. Its not cmd.exe sepcific, I use Console2 for powershell terminals
at home.

~~~
dman
I wonder if its time for microsoft to think about supporting a unix userland.

~~~
rainforest
They already do/did [1,2]. Curiously there used to be a POSIX subsystem
(alternative to Win32) but that was removed in favour of SUA.

[1] :
[http://en.wikipedia.org/wiki/Interix](http://en.wikipedia.org/wiki/Interix)
[2] :
[http://en.wikipedia.org/wiki/Windows_Services_for_UNIX](http://en.wikipedia.org/wiki/Windows_Services_for_UNIX)

~~~
tanzam75
Services for UNIX has been deprecated. It is no longer being kept up-to-date
with new Windows versions.

That's because the primary purpose of these tools was _not_ to provide a UNIX
environment for users. Rather, it was to provide a transition to Win32 for
developers of UNIX applications. In version 1, you'd move the UI over to
Windows, and leave the back-end mostly unchanged. In version 2, you'd then
rewrite the back-end for the Windows API.

At this point, if you haven't already ported to Win32, then you're probably
running on Linux.

------
mariusmg
A properly configured ConEmu is pretty much the same as Linux terminals. It
has tabs, transparency, background images, colors, proper copy paste, path
autocompletion. What's missing ?

Here's mine in action
[http://i.imgur.com/S5mkXq6.png](http://i.imgur.com/S5mkXq6.png)

~~~
kevingadd
Does conemu work right with applications like python? One common problem with
layers over the console subsystem is that it's not possible for an application
to detect that it is being manipulated by an interactive console anymore,
because the layer over it (console2, mintty, etc) looks like a pipe.

To be fair, I haven't tested this out in a while, so maybe they fixed it. But
last time I tried, python would see that pipe and assume you were piping a .py
file into it instead of launching the interpreter. IIRC the problem is related
to how 'isatty' works on win32.

~~~
ygra
At least Console2 isn't a pipe but instead polls the screen buffer of the
invisible console window of the guest application. But could be that things
have changed by now.

------
mmgutz
Tip: You can run any graphical app as a tab in ConEmu. There's really no need
for BitVise. You can run PuTTy and even Sublime inside a tab AND initiated
from command line.

Try this iTerm2 :)

[http://i.imgur.com/FWigyp6.png](http://i.imgur.com/FWigyp6.png)

~~~
blktiger
Hey, that's cool... how did you configure that?

~~~
shadowfox
If you are asking about attaching GUI applications to tabs, there are a few
ways to do that: [https://code.google.com/p/conemu-
maximus5/wiki/LaunchNewTab#...](https://code.google.com/p/conemu-
maximus5/wiki/LaunchNewTab#Attach_existing_console_or_GUI_application)

You can also configure it to start in a tab

------
haddr
I always have this feeling, that console is more about tools that you can run
(such as unix commands), than just some console improvements (like command
history, copey-paste, etc.). I think the article focuses more on the latter.

Anyway, for people who really need some linux tools, cygwin is some viable
option.

For hardcore hackers, I'd run an instance of colinux. you can the whole linux
environment within windows with almost no performance overhead. (don't forget
to configure "cofs" for windows files access.)

~~~
rainforest
Doesn't coLinux rely on using a device driver to give the Linux kernel a
dedicated chunk of physical RAM? Not quite overhead, but worth considering.

------
steven2012
Personally I love the "cycle through the options" of the Windows Command Line.
It's the one thing that I wish bash could emulate, instead of the "Show me all
the options". For me, it's a lot more functional, because it doesn't require
me to figure out what the differences are between file names. For example,
trying to find the difference between R0BCRWPY_1373654012 vs
R0BCRWPY_1373647568 is very tedious, especially if you have a bunch of
similarly named files.

~~~
sigil
It's possible in bash too. In your .bashrc:

    
    
        # tab key: cycle through the list of partial matches
        bind "\C-I":menu-complete
    
        # ^p: traditional completion
        bind "\C-p":complete

~~~
edvinbesic
Also, I have my Shift-TAB bound to menu-complete-reverse. The way I got it to
work is to chuck these two lines into ~/.inputrc

    
    
      TAB: menu-complete
      "\e[Z": "\e-1\C-i"
    

The second line is the non-obvious one, can't remember where I found it. I
wasn't able to get this to run unless it was in .inputrc though.

------
xradionut
I'm spoiled using IPython on Linux. Even the latest PS IDE on Windows 2012 is
a infant compared to the CLI tools on a Unixy OS.

------
jervisfm
Another nice terminal emulator for windows is MobaXterm[1]. It comes a single
exe and has out of the box support for connecting to remote servers using a
number of protocols.

One of the features I like is its builtin support for X-forwarding. I never
quite got why Windows didn't (and still does not) come with a full-featured
SSH client. On a Mac/Linux host, you can simply type 'ssh -X user@example.org'
and be on your way, but not so on Windows. Sigh.

[1] - [http://mobaxterm.mobatek.net/](http://mobaxterm.mobatek.net/)

------
sanyi
I'm surprised Emacs was not mentioned. It provides a nice cross-platform
interface to ... everything. Also everything (including looks) can be
customized!

~~~
npsimons
As someone who practically lives in Emacs running in Cygwin, I can second
this, with some caveats: there are tradeoffs. Windows FS access and process
forking are still dog-slow, even in native apps. To add to that, there are
things I can't run in the native version of Emacs (w3m-el comes to mind), but
you trade occasional lockups in Cygwin Emacs. Compare Linux where I run the
same setup for Emacs _for months_ if not _years_ with no problems; even if
Cygwin Emacs stays up that long, I will eventually (usually every week or so)
be forcibly rebooted for Windows updates. If I never have to work with
proprietary software again (especially Microsoft products), it will be too
soon.

------
emehrkay
"Putty has always been the gold standard of terminals, for me."

\--comment on the post

Really? Maybe he means in the Windows world.

------
krakensden
Why do all Windows consoles use crazy thick fonts? It always seems weird to
me, as someone weaned on xterm.

~~~
bluedino
For one, they are bitmap fonts, based on what you'd usually see in video
hardware ROM. Using a thinner font would cause DOS applications (the first,
and main thing you'd run in a DOS box) to look really bad. Remember they would
use things from the (character
set)[[http://en.wikipedia.org/wiki/Code_page_437](http://en.wikipedia.org/wiki/Code_page_437)]
to do windows and such in text video modes.

In the current day, the non-bitmap fonts such as Consolas don't translate well
when using things like RDP or other remote tools. Partially because you lose
things like font smoothing which make them more readable and partially because
of compression artifacts obscuring characters.

~~~
krakensden
Almost all Linux distributions without an Android userland have a nice
selection of bitmap fonts that are noticeably thinner. I've never noticed ill
effects in curses applications.

Your last sentence is confusing to me. RDP supports ClearType, and lossy
compression is disabled by default (and only arrived in what, 2008 R2?.)

------
headbiznatch
Powershell is really quite good if you don't mind learning a slightly
different shell. And there are good tools to extend it (PowerGUI is one I
like).

~~~
kjerk
Powershell on ConEmu is a joy to use, especially after you add in posh-git.
When I found out Powershell can instantiate and call .net objects and
functions (including threads) I immediately set out to convert all my batch
scripts to powershell scripts and haven't looked back.

~~~
headbiznatch
Nice! Thanks.

------
krapp
Whatever happened to DOSSHELL?

~~~
freehunter
Windows doesn't run on top of DOS anymore, and with that, DOS Shell was
deprecated in favor of the command emulator.

