POSIX/UNIX Utilities Under Windows

How to get GNU Utilities running on Windows

1. Introduction

Any half-way serious user of UNIX command line tools quickly gets disgusted with the what Windows makes available. Thankfully some other people were sufficiently annoyed to help out here. This document discusses to major paths you can take to get closer to genuine POSIX style commands under Microsoft Windows.

2. Choices Choices

Project Name Mode Description Advantages Disadvantages
Cygwin Custom Forces nearly a full POSIX environment upon Windows.
  • Closest to POSIX
  • Complex and large resources used
http://www.cygwin.com/
UnixUtils Native Popular GNU commands compiled to run in native Windows mode.
  • Lightwight.
  • Does not require Windows Registery
  • Does not support all features normal UNIX/POSIX users may expect.
  • Some command names conflict with Windows commands.
  • Weakened shell (still vastly better than COMMAND.COM).
http://sourceforge.net/projects/unxutils
vim Native GUI Vim Visual editor (consider as companion to UnixUtils)
  • Full vim for Native Windows mode
  • It's genuine vim (considered by some too different from vi)
http://www.vim.org/
PuTTY Native GUI ssh and scp command family by Simon Tatham
  • Very popular secure shell commands
 
http://www.chiark.greenend.org.uk/~sgtatham/

3. Installation Conventions

This author prefers to install third party programs under the tree "C:\Program Third" rather than "C:\Program Files". This allows better separation of Microsoft software from the rest of the world.

The primary exception to this rule is when the third-party installers are too stupid to install properly anywhere but "C:\Program Files".

You must change the instructions herein to match your own installation conventions.

4. Custom Modes

4.1 Cygiwn Installs

Not discussed here yet as I haven.t used Cygwin in years

5. Native Modes

The various native mode application bundles described here are independent of each other. You can install them in any combination desired. This document assumes you want to integrate them together.

5.1 Vim

Install vim within your standard directory tree. Notice where the binary itself is left (gvim.exe) as it must be added to PATH under UnixUtils.

Note that the name is gvim rather than vi or vim.

5.2 PuTTY Family

Install within your standard directory tree. Notice where the binaries go as they must be added to PATH under UnixUtils.

Note that the names start with "p" (e.g., putty for ssh operations, pscp for scp).

PuTTY comes with a collection of utilites to manipulate certificates.

5.3 UnixUtils

These provide the bulk of the popular GNU command line utilities. A shell derived from FreeBSD "sh" shell is also installed. Installation is simple: simply unzip the file into the proper directory. This author would use "C:\Program Third\UnixUtils". Your system may vary.

The binaries from this install are spread over several directories. Due to some file names conflicting with native Windows commands, unconditionally putting these directories in the PATH variable is a bad idea as either Windows or UnixUtils will sometimes find the wrong programs.

This author solves the conflicts by always starting the "sh" shell from a shortcut that does the right configuration, including setting PATH, for the shell being run. All programs running in that window inherit the UnixUtils configurations. As this file is edited early on it is given a ".txt" extension to allow it to easily be edited from Notebook or Wordpad.

A typical "sh.txt" file follows, stored in the UnixUtils directory:

# sh.txt -  shell script to initialize UnixUtils sh.exe

export PATH="C:/Program Third/Vim/vim71;C:/Program Third/UnixUtils/usr/local/wbin;C:/Program Third/UnixUtils/bin;C:/Program Third/PuTTY;$PATH";

export SHELL="$0";

export PS1="$( basename "$HOME" )\$ ";

cd "$HOME"
if [ -f _profile ]; then . _profile; fi

cd "$HOME/My Documents"

pwd

exec c:/Program Third/UnixUtils/bin/sh.exe
Some special notes:

The Windows shortcut is set up as follows:


 
   ============================================================

   ============================================================
[home] / [writings]writings
[AnyBrowser]
NetMechanic HTML Code Excellence Award
.http://www.exit109.com/~ghealton/writings/POSIX_under_Windows.html  
 Hits since 2008-02-06: [unavailable]  $Id: POSIX_under_Windows.hmac,v 1.1 2008/02/06 12:13:31 ghealton Exp $
Last formatted 2008-02-06
(Disclaimer)