The bulk of my career so far has been spent in the UNIX world on RISC workstations and Linux PCs.  When I switched to developing on the Microsoft stack a few years ago, it took a little time to get used to doing things differently from the command line.  I thought I’d document some useful tips here in my blog, and this post will be the first in a series.  To find related articles, click on the from-unix-to-windows tag at the bottom of this article.

There have been many flavors of UNIX throughout its history, since it dates all the way back to 1970.  Let’s just concentrate on Linux for now, strictly speaking a UNIX-like operating system.  When we speak about a Linux distribution such as Fedora, we’re actually talking about two things: the Linux kernel and the GNU userland applications.  The GNU commands can run on any operating system which has the GNU system libraries, which can be ported as long as POSIX support is available.  For example, Nexenta combines the OpenSolaris kernel with GNU userland applications.

In the Windows world, the Cygwin project is a rather comprehensive implementation of lots of what we usually call Linux.  However, if all you need are common commands such as grep, curl, gzip, and tar, then take a look at Gow: GNU on Windows.  As of version 0.5.0, 133 commands are included:

PS C:\Users\Matt> gow --list
Available executables:

 agrep, ansi2knr, basename, bash, bc, bison, bunzip2, bzip2,
 bzip2recover, cat, chgrp, chmod, chown, cksum, cmp, comm,
 compress, cp, csplit, curl, cut, cvs, dc, dd, df, diff,
 diff3, dircolors, dirname, dos2unix, du, egrep, env, expand,
 expr, factor, fgrep, flex, fmt, fold, fsplit, gawk, gclip,
 gfind, gow, gplay, grep, gsar, gunzip, gzip, head, id,
 indent, install, join, jwhois, less, lesskey, ln, logname,
 ls, m4, make, md5sum, mkdir, mkfifo, mknod, mv, mvdir,
 ncftp, nl, od, pageant, paste, patch, pathchk, pclip,
 plink, pr, printenv, printf, pscp, psftp, putty, puttygen,
 pwd, recode, rm, rman, rmdir, rsync, scp, sdiff, sed,
 seq, sftp, sh, sha1sum, shar, sleep, sort, split, stego,
 su, sum, sync, tac, tail, tar, tee, test, touch, tr,
 type, uname, unexpand, uniq, unix2dos, unrar, unshar,
 unzip, uudecode, uuencode, vim, wc, wget, whereis, which,
 whoami, xargs, yes, zcat, zip

Here’s what author Brent Matzelle has to say about it:

Gow (Gnu On Windows) is the lightweight alternative to Cygwin. It uses a convenient Windows installer that installs about 130 extremely useful open source UNIX applications compiled as native win32 binaries. It is designed to be as small as possible, about 10 MB, as opposed to Cygwin which can run well over 100 MB depending upon options.

Installing and using Gow is very simple.  A directory containing the above commands will be added to your path, which can then be run from the command line.  Uninstalling GOW is also quite simple.

You’ll eventually want to learn Powershell, but if you’re coming from UNIX and need to get something done quickly, Gow can be your friend.  For a taste of Powershell, try:

get-process | where-object {$_.WorkingSet -gt 20000000} | out-gridview

This displays a nice table of all processes with a working set greater than 20 MB, without resorting to screen scraping.  Cool stuff.