Windows

DIY: Add Gnu command line goodness to your Windows machine

If you want to make the Windows command prompt more powerful without spending cash or jumping through too many hoops, Gnu On Windows is just what you need.

One of the biggest problems I have when switching back and forth between Linux and Windows is the command line. I hate the way the Windows command line is set up; there is no global PATH to set, the command syntax is foreign, and numerous commands that I depend upon daily that are missing.

That's why I was so happy to come across Gnu On Windows (Gow). This incredibly handy tool will make the Linux admin (or anyone who is more comfortable on the Linux/UNIX command line) feel a bit more at home on the Windows command. But even better is that Gow expands the Windows command line with nearly 130 useful Gnu commands.

These are just a fraction of the commands that come with Gow upon installation:

  • Shell scripting: bash, zsh
  • Compression: gzip, zip, bzip2, compress
  • SSH: putty, psftp, pscp, pageant, plink
  • Download/upload: cURL, wget
  • FTP: NcFTP
  • Editing: vim
  • Text search/view: grep, agrep, less, cat, tail, head
  • File system: mv, cp, du, ls, pwd, rmdir, whereis
  • Development: make, diff, diff3, sleep, cvs, dos2unix, unix2dos

Installing Gow

To install Gow, you simply download the latest version and run the installation binary. When the installation is complete, in the Start | Gow menu, you'll find a Readme file, an Uninstall executable, and a folder containing the licensing information. You won't find an executable for any of the tools installed by Gow because the applications installed are part of the Gnu Utilities, so these are command line only tools.

But certainly one would have to figure out a way to set a $PATH directive so the commands are global, right? Wrong. The installation takes care of this for you. One thing I like about the Linux/UNIX command line is that the thousands of core commands are global, so they can be run from within any place in the folder hierarchy.

Testing Gow

Now that Gow is installed, let's run a test. Open the command prompt (click Start and then enter cmd in the run field) and issue the command gow - -list (no space between the dashes). You will see all of the available commands waiting for your input (Figure A). Figure A

Each command you see is available as a global command.

Running a command

Let's say you want to create a text-based configuration file or edit a file such as the hosts file. There's no need to open Notepad when you have access to vim. To open vim, just issue the command vim, and the text editor will be at your disposal (Figure B). If you want to open a previously created file for editing (say C:\test.txt), the command would be vim C:\test.txt. Make sure you know how to use vim before you plunge into this action, or else you'll drive yourself crazy trying to figure out this incredibly powerful editor. Figure B

That is not a Windows 7 theme on a Linux box, but rather full-blown vim running on Windows 7.

The rest of the commands will vary in their usage. You won't find man pages for the commands (as you would in Linux/UNIX), but you can issue the command like so: command - -help (no spaces between the dashes and where "command" is the actual command you want to run). This command structure will list out the command syntax as well as the options available for the command.

Conclusion

If you're looking for a way to make the Windows command prompt more powerful without spending cash or jumping through too many hoops, the handy Gow application is just what you need. Give it a go, and see if you don't find your Windows machine better suited to your Linux/UNIX admin background.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

4 comments
marcdw
marcdw

Upon closer inspection it seems most of the tools are from the old UnxUtils package but even that was updated to 2003. Most of the utilities in Gow are from 1999-2001 with some value added extras like the putty package and very recent wget & curl. On an old ThinkPad I have that didn't have room for a *nix installation I had put all kinds of *nix-like tools on it so I could feel a little at home. The GnuWin32 packages are much more recent (up to 2010) which I then supplemented with bits from the UnxUtils package (like gplay, gclip, pclip - also in Gow). A couple of other packages that are more development-oriented are the Janotech Unix Shell for Windows (a ksh-based environment allowing for creation of apps using stdwin lib) or SoftIntegration's Ch (shell that's a superset of C and apparently will let you "run" a .c/.cpp file). Both include all the other *nix goodies and utilities. Ch includes bash and vim. At least these all run on top of Windows instead of subsystems like Cygwin/SFU/SUA. Lastly, for those who love 'ls' but hate 'dir' check out utools.com's GNU ls for Microsoft Windows. Man page description... "It displays exhaustive information on DACLs/SACLs, integrity levels, reparse points, shortcuts, hard links, symbolic links, hidden streams, encryption, compaction, virtualization, volume serial number, object tracking identifier, and offline status." It has full color support, dircolors (bring your favorite .dircolors over from Linux), and also includes a color-enabled grep. Fun stuff.

Neon Samurai
Neon Samurai

I remember having a Gnu pack for windows a while back but lost track of it. having grep/sed/vim back like this will be very nice indeed. No more copying logs to my Debian box just to do a little sort and filter.

seanferd
seanferd

Excepting DiG. Dig for Windows is always nice.

Editor's Picks