Tuesday, May 27, 2008

Running UNIX Applications on DOS/Windows Machines

The MKS Toolkit

As operating systems, the UNIX System and Windows are similar in some ways. The UNIX System and Windows both support multiple users and multitasking. Therefore, it is possible to create a good approximation to the working environment created by the shell and the common UNIX System tools on a Windows platform. A number of software packages exist that help you do this, including the MKS Toolkit from MKS, Inc. (formerly Mortice Kern Systems at http://www.mks.com/ or mkssoftware.com/). This product has grown significantly since its initial release to include new tools and APIs, but one of the original uses that is still relevant is that it provides an implementation of the shell and basic tools that you can use on your Windows computer. Inevitably, some look-alike commands work slightly differently from the UNIX System originals, because of fundamental differences between the two operating systems. Nevertheless, you will find the look-alike tools a useful bridge between the two operating systems, and a good way to ease gently into using a UNIX System.

This discussion will concentrate on some of the more useful commands included in the MKS Toolkit. The MKS Toolkit contains a collection of more than 100 commands-that correspond to most of the common UNIX System commands, including vi, awk, and the Korn shell, as well as commands such as strings and help-that you can run on a Windows computer.

In some cases, the UNIX System tools provide an alternative to a similar DOS command. For example, cp can copy several files at once, and rm can remove several files at once. In addition, the MKS Toolkit offers commands that do not have a DOS equivalent, such as file, strings, and head. Many DOS files are in the form of binary data; the Toolkit offers file to identify them, and od and strings to examine them. Many tools such as head, diff, and grep are useful for dealing with ASCII text files.

You run the MKS Toolkit commands as you would any other DOS commands. You simply type the command name with any options or filenames that it requires. For example, to view the contents of the current directory using ls, you type the command name:

C:\> ls

The MKS Toolkit includes a help command that is particularly useful when learning to use UNIX System commands on Windows. It displays the list of options that go with each command. To use this, type help followed by the name of the command, as shown here:

C:\> help ls

Experienced Windows users should refer to the chart of differences in commands between UNIX and DOS earlier in this chapter. It is easy to start out with commands like ls, pwd, or help. Next you might try file, strings, head, or od to give yourself an idea of the range of the UNIX System tools provided by MKS. You should now begin to recognize the power and flexibility that UNIX-style tools add to your Windows environment.

Other UNIX Toolkits and Applications for Windows

In addition to MKS, Inc., SourceForge provides a large number (over 100) of common GNU utilities that have been ported from UNIX to the native Win32 platform. These utilities depend on the existence of the Microsoft C-runtime routine msvcrt.dll but do not require the emulation layer provided by Cygwin/X. You can download these utilities from the Source Forge web page at http://unxutils.sourceforge.net/.

No comments: