Running Window, DOS, and Macintosh Applications

Running Window, DOS, and Macintosh Applications

Linux is ready to run most applications that were created specifically for Linux, the X Window System, and many UNIX systems. Many other applications that were originally created for other operating systems have also been ported to Linux. There are still, however, lots of applications created for other operating systems for which there are no Linux versions.

Linux can run some applications that are intended for other operating systems using emulator programs. An emulator, as the name implies, tries to act like something it is not. In the case of an operating system, an emulator tries to present an environment that looks to the application like the intended operating system.


The most popular of these emulators, called WINE, is not really an emulator at all. WINE is a mechanism that implements Windows application-programming interfaces; rather than emulating Windows it provides the interfaces that a Windows application would expect. In fact, some people claim that WINE stands for "WINE Is Not an Emulator."

In the next sections, I discuss emulators that enable you to run applications that are intended for the following operating systems:

  • DOS

  • Windows 3.1

  • Windows 95

  • Windows 98

  • Windows 2000

  • Windows NT

  • Windows XP

  • Macintosh


    In theory, any application that is Win32-compatible should be able to run using software such as WINE (described later). Whether or not a Windows application will run in an emulator in Linux must really be checked on a case-by-case basis.

Emulation programs for running DOS programs are available for Red Hat Linux. You need to install the dosemu and/or xdosemu packages (which are available from DOS emulation commands from these packages include: dos, xtermdos, dosdebug, xdos, and dosexec. Other operating system emulation programs can be added to your system, including:

  • WINE, which lets you run Windows 3.1, Windows 95, Windows 98, Windows 2000, Windows NT, and Windows XP binaries. (Windows NT and XP programs are not well supported.)

  • ARDI Executor, which enables you to run applications that are intended for the Macintosh operating system.

In general, the older and less complex the program, the better chance it has to run in an emulator. Character-based applications generally run better than graphics-based applications. Also, programs tend to run slower in emulation, due sometimes to additional debugging code put into the emulators.

Running DOS applications

Because Linux was originally developed on PCs, a variety of tools were developed to help developers and users bridge the gap between Linux and DOS systems. A set of Linux utilities called mtools lets you work with DOS files and directories within Linux. A DOS emulator called dosemu lets you run DOS applications within a DOS environment that is actually running in Linux (much the way a DOS window runs within a Windows operating system).

Using mtools

Mtools are mostly DOS commands that have the letter m in front of them and that run in Linux (though there are a few exceptions that are named differently). Using these commands, you can easily work with DOS files and file systems. Table 5-4 lists mtools that are available with Linux (if you have the mtools package installed).

Table 5-4: Mtools Available with Linux




The DOS attrib command, which is used to change an MS-DOS file attribute flag.


The DOS badblocks command, which tests a floppy disk and marks any bad blocks contained on the floppy in its FAT.


The DOS cd command, which is used to change the working directory to another DOS directory. (The default directory is A:\) that is used by other mtools.


The DOS check command, which is used to verify a file.


The DOS copy command, which is used to copy files from one location to another.


The DOS del command, which is used to delete files.


The DOS deltree command, which deletes an MS-DOS directory along with the files and subdirectories it contains.


The DOS dir command, which lists a directoyr's contents.


The Linux du command, which is used to show the amount of disk space used by a DOS directory.


The DOS format command, which is used to format a DOS floppy disk.


This command is used to print information about a DOS device, such as a floppy disk.


This command is used to create a shell script that restores Linux filenames that were truncated by DOS commands.


The DOS label command, which is used to make a DOS volume label.


The DOS md command, which is used to create a DOS directory.


This command is used to mount a DOS disk in Linux.


The DOS move command, which is used to move a file to another directory and/or rename it.


The DOS rd command, which is used to remove a DOS directory.


The DOS ren command, which is used to rename a DOS file.


This command is used to show the FAT entry for a file in a DOS file system.


This command is used to test the mtools configuration files.


The DOS type command, which is used to display the contents of a DOS text file.


This command is used to perform operations with Zip disks, including eject, write protect, and query.

I usually use the mtools to copy files between my Linux system and a Windows system that is not on my network. I most often use mcopy, which lets me copy files using drive letters instead of device names. In other words, to copy the file vi.exe from floppy drive A: to the current directory in Linux, I would type:

# mcopy a:\vi.exe

By default, the floppy-disk drive can be read from or written to only by the root user and the floppy group. To make the floppy drive accessible to everyone (assuming it is floppy drive A:), type the following as root user: chmod 666 /dev/fd0.

Using dosemu

The DOS emulator package dosemu no longer comes with the Red Hat Linux distribution. To use dosemu, you can try to install source code available from

With the utilities that come with the dosemu package, you can run DOS applications, as well as use your computer as if it were running DOS. This includes accessing hardware, working with DOS configuration files, and using the DOS file system.

The following commands can be used to start dosemu within Linux:

  • dos — Starts the DOS emulator in any shell.

  • xdos — Starts the DOS emulator in its own X window.

  • xtermdos — Starts the DOS emulator in an xterm window.

  • dosdebug — Starts a debug program to view information and error messages about a running DOS program.

Basic information about your DOS environment is set in the /etc/dosemu.conf file. The following list describes how the DOS environment is set up and how to change it:

  • CPU — The CPU is set to emulate an 80386 (Intel 386-compatible). You can change the $_cpu value to 80486 or 80586 (for Pentium).

  • Keyboard — The keyboard is set to auto, which tries to set the keyboard based on the current Linux console settings. You can specifically change the keyboard type by setting the $_layout value to a variety of other country/language combinations listed in the dosemu.conf file (such as us for US/English, de for German, or it for Italian).

  • X Settings — There are several X settings (beginning with $_X) that let you change things such as the title in the DOS window, the font used, and the cursor blink rate.

  • Floppy Disks — Floppy disk A (/dev/fd0) is set to a 3.5-inch floppy (threeinch) and floppy disk B (/dev/fd1) is not assigned. Either disk can be assigned to be 3.5-inch (threeinch), 5.25-inch (fiveinch), atapi, or empty.

  • Hard Disk Images — The file system that appears when you start DOS is actually a disk image file stored in /var/lib/dosemu. By default, dosemu uses hdimage.first (which is linked to hdimage.freedos). You can change that to another DOS image or to a DOS file system (such as /dev/hda1, if that partition were a DOS partition).

  • Serial Ports — No serial ports are assigned by default. You can assign any of the serial ports ($_com1 to $_com4) to a device such as a modem (/dev/modem), a mouse (/dev/mouse), or a terminal line (/dev/tty0).

Dosemu is set up for the root user. It is not very secure to allow multiple users to have access to DOS because DOS does not have the same security protections for files and devices that Linux does. If you want other users on your Linux system to use DOS, however, edit the /etc/dosemu.users file so that it includes the following lines:

root c_all
all c_all

For more information on dosemu, visit the dosemu home page at

Running Windows applications with WINE

The WINE project ( has been making great strides in getting applications that were created for Microsoft Windows to run in Linux and other operating systems. WINE is not really an emulator, because it doesn't emulate the entire Windows operating system. Instead, because it implements Win32 application programming interfaces (APIs) and Windows 3.x interfaces, the WINE project is more of a "Windows compatibility layer."

To get WINE for your Red Hat Linux system, there are several places you can go:

  • Download sites — You can download WINE free of charge from several different Web sites. Check for a list of download sites. I downloaded the latest RPMs built for Red Hat Linux from this site: WINE daily builds (in RPM format) are available from

  • WineX — A commercial version of WINE, called WineX, is available from TransGaming, Inc. ( TransGaming focuses on running Windows games in Linux, using WINE as its base. See Chapter 7 for descriptions of WineX.

  • CodeWeavers — If you need Microsoft Office or Web browser plug-ins, CodeWeavers ( offers CrossOver Office and CrossOver Plug-in, respectively. Although these products cost some money, they offer friendly interfaces for installing and managing the Windows software and browser plug-ins that it supports.

While it's true that you can run many Windows applications using WINE, some fiddling is still required to get many Windows applications to work. If you are considering moving your desktop systems from Windows to Linux, the current state of WINE provides an opportunity to see if some Windows applications you need might run in Linux.


I suggest that you test out any application you want to use in WINE before you put it on any computer that is a critical part of your work. Although I haven't done serious damage to my computer, WINE still freezes up the desktop under certain conditions.

Besides developing software, the WINE project maintains a database of applications that run under WINE. More than 1000 applications are listed, although many of them are only partially operational. The point is, however, that the list of applications is growing, and special attention is being paid to getting important Windows 98 and 2000 applications running.

Although not an open source products, VMware and Win4Lin are other good ways to run Windows applications along with a Linux system on the same running computer. With VMware you can simultaneously run Windows 98, Windows NT, Windows 2000, Windows XP, and Linux operating systems on the same PC. You can get more information about VMware from Win4Lin ( lets you run Windows applications in a running Linux system.

The next section describes how to set up Linux to run Windows applications using WINE.

Understanding WINE

For WINE to let you run Windows applications, it needs to have an environment set up that looks like a Windows system. When you install the wine package in Red Hat Linux, the package creates /etc/wine/wine.conf and /etc/wine/system.reg files that, like the Windows registry, identify the locations of components an application would need in a Windows operating system.

The location of the basic Windows operating-system directories for WINE is the /usr/share/wine-c directory (in other words, drive C:) by default. Table 5-5 shows how C: and other Windows drive letters are mapped into Linux directories and devices.

Table 5-5: Windows Drive Letters in WINE


Drive Letter or Name

Linux Directory or Output Location

Linux Device Name (If Applicable)

Floppy drive




Hard disk #1








Temp directory




User's home directory


$HOME (user's home directory)


Root directory




Serial ports










Parall ports




Print spooler


Pipes printer jobs to the lpr command (| lpr)



Win95 (how the system appears to apps: Win31, Win98, or the default Win95)


Within the /usr/share/wine-c directory (that is, your C: drive), you should see some things that are familiar to you if you are coming from a Windows environment: autoexec.bat and config.sys files (empty to start with), and My Documents, Program Files, and windows directories.

Assuming that the basic directory structure is okay with you, you may still want to consider changing a few items. For example, you may want to change the command to print documents (set in the /etc/wine.conf file) to something other than the "| lpr" command to use a particular printer or add some Linux printing options.

Setting up Windows applications

The best way to understand how to set up and run a Windows application is to step through the process of getting a simple Windows accessory to run in WINE. To do this procedure, you will need the following:

  • The wine package installed in Red Hat Linux.

  • Access to MS Windows components, including the executable program you want to run and the DLL files the executable needs to run.

If you have a dual-boot system (Red Hat Linux and Windows), the best way to do this procedure is to have Linux running with the Windows partition mounted somewhere so that you can copy the files you need. Otherwise, you should skip the first step and copy the files you need from a floppy or CD, or over the network.

In this example, we want to be able to run the Microsoft Paint program (mspaint.exe) from Windows in Linux using WINE. Here is an example of how to go about it.

  1. If you have a dual-boot system start by mounting the Windows partition. Here's how:

    • As the root user, from a Terminal window, type:

      # fdisk –l

      This lists your hard-disk partitions. Look for a partition that is listed as something like WIN95 FAT32.

    • Make a directory on which to mount your Windows partition. For example, to use the /mnt/win directory, type:

      # mkdir /mnt/win
    • Assuming that the Windows partition is on the first partition of the first IDE hard disk (/dev/hda1), type the following to mount the Windows partition:

      # mount –t vfat /dev/hda1 /mnt/win

      At this point you should have a mounted Windows partition available from /mnt/win.

    • To make that partition permanently available to you from Linux, add the following line to your /etc/fstab file:

      /dev/hda1          /mnt/win         vfat      defaults     0   0

    The preceding entry causes the Windows partition to mount automatically on /mnt/win each time your Red Hat Linux system boots up.


    For the purposes of the rest of this procedure, I assume that you have a Windows system accessible from /mnt/win. If this is not the case, you need to find a way to copy files from your Windows system on another computer to the locations described in this procedure.

  2. Copy the mspaint.exe program to a location accessible from your Linux computer. For example, with a mounted Windows partition as previously described, you could type:

    # cp /mnt/win/Program\ Files/Accessories/mspaint.exe /bin
  3. Run the wine command with mspaint.exe as an argument to see if it can run or if it needs some added DLL files.

    # wine /bin/mspaint.exe
    err: module:PE_fixup_imports Module (file) MFC42.DLL (which is
             needed by Z:\a\mspaint.exe) not found

    This says that you need the mfc42.dll file to be able to run mspaint.exe.

  4. Next, copy the necessary DLL file from the Windows partition. For example:

    # cd /usr/share/wine-c/windows/system
    # cp /mnt/win/windows/system/mfc42.dll mfc42.dll
  5. With the proper DLL files installed, type wine /bin/mspaint.exe again and the MS Paint window opens. An example of the Paint window running in Red Hat Linux is shown in Figure 5-3.

    Click To expand
    Figure 5-3: Running Paint in Red Hat Linux using WINE.

In Figure 5-3, Paint is displaying a bitmap image that I opened from the Red Hat Linux file system. Choose File ? Open. In the Open dialog box, you can see how the application views the locations available to it. The C:, D:, E:, F:, and Z: drives all represent the locations shown in Table 5-5. (The computer in the example didn't have a floppy, or you would see an A: too.)

Finding Windows applications for WINE

Applications that have been tested to run under WINE are maintained at the Wine Application Database ( The database is divided into the following categories:

  • Educational Software and Computer-Based Training

  • Games

  • Multimedia

  • Networking & Communications

  • Productivity

  • Programming / Software Engineering

  • Reference, Documentation, and Information

  • Scientific, Technical, and Mathmatical

  • Special Purpose

  • Utilities

Hundreds of applications have been submitted for the database. Most of the packages that have been tested are games. In most cases, the person listing the application describes the platform he or she tested on and any experiences he or she had getting it to run. The host of the list,, asks that you create a login to access the database.

Running Macintosh applications with ARDI Executor

Besides enabling you to run many popular Macintosh applications on the PC, ARDI Executor ( from ARDI, Inc. lets you work with Mac-formatted floppies and a variety of Mac drives. Find more about ARDI Executor from

ARDI also maintains a listing of compatible Mac software in its Compatibility Database. There are literally hundreds of Mac applications listed. Each application is color coded (green, yellow, orange, red, or black) to indicate how well the software runs under ARDI. Green and yellow are fully usable and largely usable, respectively. Orange is mostly unusable. Red means the application won't run at all, and black means it won't run because it requires features that aren't implemented in ARDI. At a glance, about two-thirds of the applications listed were either green or yellow.

Part IV: Red Hat Linux Network and Server Setup