Thursday, 12 July 2007

How to get a decent console under Windows

The reason

I had to switch to windows for some time and, after working under ubuntu for over a year, I finally realized what linux users meant when saying that win wasn't userfriendly. Linux' great power comes from its extensibility (obviously) and customizability. The poor support for the latter drives me mad every time I need to use win. It took me couple of days to set up a usable and useful console, so hereby I include the recipe.

Tabs and good look

Since being console under windows means running in one, to get a tabbed view we need to download a wrapper. Its name is, surprisingly, Console and the tabs feature is enabled in latest versions (Console2 has it, while 1.5 not. if you download the latest version (>2.0.131), you will get multiple shell support as well). There's no need to install. Just extract, run the Console.exe, et voila. Much prettier, isn't it. It is a good idea to put the folder in some appropriate place (like c:\Program Files\Console2).

Shell

Next thing we're gonna need is Powershell. I still haven't dicovered all its features, but tab completion, automatic slash-to-backslash convertion and aliases to many bash commands (including man and ls, yipeee!) makes it good enough for me. You can download it from microsoft's site. To get Console running with powershell you can use its options window (Edit/Settings...).

Multiple shell support

Console can use multiple shells. How does it work? Say, you prefer using powershell, but it's not fast enough for your machine. Or you use apps with command line interface quite often (python, mysql, irb). Here's how you can get Console to use all of them: open the console.xml file in your console dir, and find the <tabs> tag. Every tag is a preset for a type of console to open. There is only one <tab>...</tab> entry now. Duplicate it, and edit the shell attribute in the <console> inner tag. Here's what the section may look like afterwards:




<tabs>
<tab title="Powershell">
<console shell="powershell" init_dir=""/>
<cursor style="0" r="255" g="255" b="255"/>
<background type="0" r="0" g="0" b="0">
<image file="" relative="0" extend="0" position="0">
<tint opacity="0" r="0" g="0" b="0"/>
</image>
</background>
</tab>
<tab title="IronPython">
<console shell="ipy" init_dir=""/>
<cursor style="0" r="255" g="255" b="255"/>
<background type="0" r="0" g="0" b="0">
<image file="" relative="0" extend="0" position="0">
<tint opacity="0" r="0" g="0" b="0"/>
</image>
</background>
</tab>
<tab title="Python">
<console shell="python" init_dir=""/>
<cursor style="0" r="255" g="255" b="255"/>
<background type="0" r="0" g="0" b="0">
<image file="" relative="0" extend="0" position="0">
<tint opacity="0" r="0" g="0" b="0"/>
</image>
</background>
</tab>
<tab title="Windows shell">
<console shell="cmd.exe" init_dir=""/>
<cursor style="0" r="255" g="255" b="255"/>
<background type="0" r="0" g="0" b="0">
<image file="" relative="0" extend="0" position="0">
<tint opacity="0" r="0" g="0" b="0"/>
</image>
</background>
</tab>
</tabs>


Keyboard shortcuts

You get by default shortcuts Ctrl+F1, Ctrl+F2, etc. for shells you set. It's customizable (obviously). It is a useful trick to define hotkeys for launching Console, so that you can run it whatever window is active. There are plenty of hotkeys deamons for win, that let you do that. I'm using Hot Keys Plus

The final effect

Here it is.

4 comments:

francois schnell said...

Hi Konrad,

I'm also in between worlds.

Personally I also find these useful:

http://virtuawin.sourceforge.net/
http://www.lopesoft.com/en/fmtools/info.html
http://www.allthingsmarked.com/2006/12/24/replace-task-manager-with-the-more-powerful-process-explorer/
http://www.launchy.net/

And the classical FileZilla, Putty, WinScp, etc.

Hope this help.

bye

francois

robert said...

FileZilla, Putty: the best apps in the world :-)

Nice blog, btw.

Edomaur said...

Hello, can you link to the different apps you are using ?

Personnally I am living between Kubuntu and Windows, using Eclipse both sides and a mix of tools like cygwin to bend the Win32 side to my taste.

However, since 3 weeks, I have discovered www.andlinux.org which is a quite good distro of coLinux and enables me to have both environnements on the same computer running at the same time.

Marcus said...

Very useful, tahnks a lot.