How to Turn Your Windows Machine into Unix

For the many years, the requirements of my job forced me to use Windows for working on parts of our code base. When working in Windows, I dearly missed the tools of a unix environment (ls, grep, the shell, etc). But over the years I've figured out a bunch of hacks that make using Windows a lot more tolerable. Here they are:

Install a real text editor - Vim or Emacs. The optimized key bindings and extra power of Emacs/Vim allow you write code or prose with amazing speed. Read Steve Yegge if you're not convinced. Put emacs in the system path, so that as you browse around in the shell you can edit files by entering ">emacs file.txt"

Install the GNU utils for windows and put them on your system path. Now you can use all your favorite unix utilities such as grep, touch, ls, diff, etc, from your windows command line.

Enable copy/paste from the command line. In the windows command prompt, click on the icon in the upper left and then click properties. Then set "Quick Edit" mode to checked. Now you can copy text by highlighting it with the mouse and hitting enter. You can paste by clicking the middle mouse button.

Install a better shell. I prefer IPython. IPython gives you most of the bash functionality and key bindings. Type Ctrl-r to search for previous commands. Ctrl-A to move to the beginning of the line, ctrl-k to kill a line, ctrl-y to paste/yank a line back, etc. The tab completion works like unix where it only completes until the point of ambiguity. The only annoying thing is that you must prefix all shell commands with "!". But on the plus side, you also have an interactive python prompt, which is handy if you need to test a snippet of code or do some quick math.

Remap Caplocks to trigger ctrl. Cap-locks is basically useless. Ctrl is used all the time in programming, especially if you use emacs. Remapping will make you type far more efficiently.

Forget about Cygwin. Cygwin offers the promise of a full unix shell from within windows. But the Cygwin environment has too many pieces that are broken or incompatible. You feel like you are in unix, but then you try to run a script and you get a deep down stack trace.  You spend six hours trying to debug it before finding that the underlying C-library is simply incompatible with the Cygwin environment. If you want to use linux on your windows box without dual booting, use a full VM like Colinux or VM Ware. I keep a small, headless, Colinux, Centos5 process running in the background that I SSH into if I need to do something that is linux only.