Most of the traffic to my blog is from search engines for a few informative posts that I made a while ago. So here goes my attempt at “informative posts” with the sole selfish intention of increasing my blog traffic. This blog is going to be lesser of a rant corner and turn more into the technical flavour it was initially intended to be. I hadn’t been the biggest fan of Windows through college. But now I use Windows a lot. I am going to writing a series of posts over the next couple of weeks detailing the steps for hardcore unix users to make his/her life comfortable in the Windows world.
In this post, I will detail how to bring the familiar unix command line shells and utilities to your windows desktop. There are two ways to achieve this, the first is to install the Microsoft Services for UNIX package, and the other is to install Cygwin. I am not familiar with the former, but I believe Cygwin is a more comprehensive solution.
- Cygwin is a unix shell emulator for Windows. You can get your copy of Cygwin from http://cygwin.com. Run the Setup.exe file from the site, choose “Install from Internet”, and choose a nearby mirror.
- In the package choosing dialog, select applications you think you would need. I would suggest that you also additionally select the X11 system, GNU Screen, the rxvt terminal emulator and the zsh shell. After selecting the packages, go and get more than 1 cup of coffee, for it takes ages to finish the download and install.
- If you are running Windows Vista, you have 1 more additional step to get cygwin running fine. Open command prompt, go to your cygwin installation directory, and run “bin/ash” (without the quotes). This will start the ash shell. Now, from the ash prompt, run “bin/rebaseall” (again without the quotes). You can then quit the shell by typing exit at the ash prompt. If you do not do this, you might face memory protection problems when launching cygwin applications.
- Now that you have cygwin running in a hale and healthy manner, we need a nicer terminal to run cygwin in, rather than the ugly cmd.exe. Browse over to http://en.poderosa.org/ and install Poderosa, for a tabbed and resizeable cygwin terminal. I would dubb Poderosa the best thing since sliced bread but then you wouldn’t believe me till you try it yourself.
- Now, open Poderosa. Select File->New Cygwin Connection... In the dialog that appears; if you want to work with bash, then just hit OK, and you will be presented with a bash shell. Or if you want to use zsh (or any other shell), select Advanced configuration and change the shell from /bin/bash -i -l to /bin/zsh -i -l and hit OK.
- Now, that cygwin and poderosa are setup, we just need to get some config files set right. You will see a warning message appear on the shell, when you initially start it. http://www.cygwin.com/cygwin-ug-net/using-utils.html suggests that you run the following command to solve this.
mkgroup -l > /etc/group
mkpasswd -l > /etc/passwdIf you are on a domain, add a -c option to the above commands
- As to what are the advantages of Poderosa:
- Resizeable windows
- Tabbed interface
- Vertical and Horizontal splitting of the screen
- Plugin based architecture
- Supports SSH connections, so it can also replace putty
- However, if you don’t like Poderosa, but still want a terminal better than cmd.exe, run rxvt from the the command line, to get the rxvt terminal. While, I will keep details of configuring rxvt for best benefits to a later post, it would do good to know some basic info about rxvt beforehand, for instance pasting in rxvt is accomplished by the key combination Shift+Insert.
- One last tuning tip, is to add the Cygwin bin directory to your Windows PATH variable. To do this, right click on My Computer, choose the Advanced tab, click Environment Variables. Under the System Variables pane, select Path and click Edit. At the end of the Variable Value string, add a semicolon(’;') and type in the installation path of Cygwin followed by a “\bin”. For example, add “;c:\cygwin\bin” (without the quotes). Click OK through all the dialog boxes. And, now you will be able to access Cygwin utilities from the the Windows (dos?) command prompt too.
Planned posts in this series include Tuning X11 for cygwin, rxvt for Windows, ZSH for productivity, Tuning GNU Screen for command line geeks and Explaning my Emacs configuration.

13 comments
Comments feed for this article
Trackback link
http://prashblog.com/2008/04/25/cygwin-tuning-guide/trackback/
April 27, 2008 at 2:08 pm
Vijay
Couldn’t agree with you more about the fewposts-moretraffic thing. All my traffic comes from 2 posts i wrote
Cool article! Can’t wait for the one on Emacs!
April 27, 2008 at 6:14 pm
Vijay Dev
“But now I use Windows a lot.”
Not one sane person who knew you in college would have dared to imagine this kind of a statement from you
But hell, its true !!
April 27, 2008 at 6:33 pm
Vijay
So true! The following happened so many times:
Casanova: Dei do u have this feature on your box?
Me: Nope
Casanova: Dei your windows box so sucks
Now,
Me: You use Windows!!??
Casanova: ah, windows
Ironical that the guy who introduced me to linux now uses windows
April 28, 2008 at 10:28 am
Prashanth
As a student, I was broke and couldn’t afford to buy software. The other reason I used FreeBSD and Linux was from a purely academic motivation. Now that I am _in_ microsoft, I have the same freedom with Windows as well.
Perhaps, I have graduated to think of Operating Systems as just another tool :-).
April 29, 2008 at 7:02 pm
Aravind Narayanan
Windows and Linux boxes are just that - boxes.
A Mac computer is a piece of art - elegant, beautiful and efficient. A perfect melding of software and hardware to produce the ultimate computing experience.
April 29, 2008 at 8:45 pm
prashmohan
I have a mac. But no, I did not get the “ultimate computing” experience.
What makes the Mac good is the unix core, what makes the mac better is macports and what makes the mac great is QuickSilver.
Beauty is just skin deep you know :-). But jokes apart, the real differentiator for the mac is their well defined and uniform HIG (Human Interface Guidelines)
June 27, 2008 at 12:39 am
sp2hari
Nice article
Was searching for a terminal better than the default one. 
June 28, 2008 at 6:11 am
wcyee
“Or if you want to use zsh (or any other shell), select Advanced configuration and change the shell from /bin/bash -i -l to /bin/zsh -i -l and hit OK. ”
Is there a way to get Poderosa to remember this? Just trying to find a way to not go through the click “Advanced configuration” and change info every time I start a shell.
Thanks.
June 28, 2008 at 7:33 am
prashmohan
Poderosa remembers my config every subsequent time. Does it not do so for you?
June 29, 2008 at 4:11 am
wcyee
The change I made was in the other field - home directory. Poderosa defaults to /home/username but my real home directory, as configured in /etc/passwd is the same as my windows home directory. Logging in using bash.bat worked fine, but Poderosa kept sending me to /home/username (unless I manually changed it). It’s entirely possible it remember changes made to the shell (bash to zsh, as in your case).
Anyway, I figured out how to fix this:
In “Poderosa\Cygterm\cygterm.cfg”, I changed the “ENV_2″ variable to reflect my root for home directories, and all is good.
Thanks for replying to my comment.
June 29, 2008 at 4:16 am
wcyee
BTW, do you notice any graphic display problems when you run Poderosa? Every now and then there’s a random pixel that lights up on the terminal, which goes away. Nothing serious, but just a little annoying.
Also, have you found a way to add more fonts? I use Consolas for my CMD and it turns up in Poderosa, but unlike CMD, there’s no way to choose a Bold Consolas.
Just thought I’d ask in case you’ve run into either issue. Questions in the Poderosa forums don’t seem to get very many replies (actually, none for the most part).
Thanks for your writeup!
June 29, 2008 at 10:58 am
prashmohan
I use the Monaco font. And no I don’t see an option to make the fonts bold either. Perhaps you could try replacing the Consolas font with the Consolas Bold font (i.e. only if you dont intend to use the Consolas regular font). Maybe it will trick Poderosa?
June 30, 2008 at 4:59 am
wcyee
I don’t want to replace the Consolas, because it looks fine when I’m using Visual Studio, but a bit strange CMD.exe or Poderosa. Making it bold works out well in the latter cases. I’ve got clear type enabled on my WinXP machine, so that’s not an issue. Anyway, I don’t know enough about fonts and displays to make an intelligent diagnosis. But I’ll try poking around the Poderosa config and registry to see if I can get it to recognize Consolas bold. Thanks anyway!
BTW, in case it matters, I’d love to read your writeups on zsh and emacs config.