Linux Classes
Share This With a Friend  

Can I Run DOS Programs Under Linux?

DOSemu (DOS Emulator) is a program that lets you run many of your favorite DOS applications under Linux. The name is a little bit misleading--it doesn't actually emulate DOS; it boots DOS to a virtual machine using the special hardware features in Intel 80386 and higher CPUs. A DOSemu session looks and acts like a real DOS session, with a few limitations on what can be done. Not all video and sound cards are supported under DOSemu, and some programs that require DPMI (DOS Protected-Mode Interface) will not run. The most notable examples are Windows-based programs, although some people do report being able to run some under DOSemu.

Setting Up DOSemu

Setting up DOSemu is not hard, but it does require a few steps to get a fully functioning DOS session up and running. Because the software is being actively developed and improved, I strongly recommend that you get the latest version available from the DOSemu Web site at After downloading the RPM file for DOSemu, issue this command while logged in as root:

rpm -i dosemu-0.98.6-1.i386.rpm

Configuring DOSemu

The package is now installed, but we need to tweak the DOSemu configuration file before using it. Edit the /etc/dosemu.conf file and modify the $_hdimage entry so that it reads as follows:

$_hdimage = "hdimage.test /dev/hda1"

The hdimage.test file resides in your /var/lib/dosemu directory and is a hard disk image--a special Linux file that contains a complete DOS system. The line you just modifed tells DOSemu to treat the hdimage.test file as the C drive when DOSemu is started. This C drive is not your beloved DOS partition; it's a simulated bootable hard-disk partition containing the FreeDOS operating systema freeware clone of MS-DOS. The /dev/hda1 portion of the modified line tells DOSemu to treat your real DOS partition as the next drive letter, or the D drive. (You can boot DOSemu directly from your real DOS partition, but we'll address that later.)

Starting a DOSemu Session

Before starting a DOSemu session, which will be accessing /dev/hda1 (your MS-DOS partition), it's very important to unmount the partition. Otherwise, the DOS virtual machine and your Linux system might be trying to write to the disk simultaneously, with potentially disastrous results. To unmount the partition, issue this command:

umount /dev/hda1

Now we're ready to fire up DOSemu. Issue the command shown here from your Linux command prompt:


In a few seconds, you should see a DOS session start, and the familiar C:> prompt will appear. Voila--you're running DOS under Linux! Issue the dir command and have a look at the results. Don't panic if the listing of files is unfamiliar. Remember--what you have here is a special C drive with the FreeDOS files that DOSemu will use to boot up.

FreeDOS in a DOSemu session.

You can switch to your D drive (your DOS partition) by issuing the D: command and then change directories, view files, execute programs, and so on. Because we booted from the C drive with FreeDOS, the config.sys and autoexec.bat files from your DOS partition were not executed. This means that your normal DOS PATH variable will not be set, so you may have to use cd to get to the appropriate directory before running a program.

Exiting from DOSemu

You can exit the DOSemu session by entering the following command at your C: prompt (note that it won't work if you are at the D: prompt):


If that doesn't work, or if your DOSemu session is frozen, log in from another virtual console and then use the ps and kill commands to find and terminate the DOSemu task. (See Chapter 3, "Living in a Shell," for details on killing an active task.)

The command "killall dosemu" will also work without having to do a ps.SmoogeIt's a good idea to copy the file from the C drive to the D drive so you can exit from DOSemu cleanly if you later decide to run DOSemu directly from your "real" DOS partition. To do so, enter this command from the C: prompt:

copy C:\exitemu D:\

Starting DOSemu with "Real" DOS

If any of your DOS programs don't run correctly as a result of finding themselves on a D drive instead of a C drive, you can start a DOSemu session by booting your "real" DOS partition. To do so, edit the /etc/dosemu.conf file and modify the $_hdimage entry so that it reads like this:

$_hdimage = "/dev/hda1"

This tells DOSemu to treat your DOS partition as the C drive and to boot the MS-DOS operating system instead of FreeDOS. Upon restarting DOSemu, MS-DOS will try to start Windows 95/98, if you have it installed. This will surely lock up your machine, because DOSemu does not support Microsoft Windows. To avoid this problem, press the F8 key as soon as the message "Starting MS-DOS" appears and then select option 6, Command Prompt Only, to boot MS-DOS without starting Windows.

Additional DOSemu Configuration

By default, DOSemu starts with text-only video support and no support for serial ports. So if you want to run any graphics programs or use the mouse or modem, exit DOSemu and continue.

To enable support for graphics or the mouse or modem, edit the /etc/dosemu.conf file as described here. I recommend that you configure only the features you really need. Take these steps one at a time and test each new feature separately by starting DOSemu. That way, if a problem arises, you'll know which feature caused it, and you can go back to the /etc/dosemu.conf file and disable it or try an alternative.

Setting Up VGA Graphics

Look for the $_graphics and $_videoportaccess entries and change them to read as follows:

$_graphics = (1)
$_videoportaccess = (1)

Start DOSemu and test your graphics program. If it doesn't work, see the copious comments in the /etc/dosemu.conf file or at the DOSemu Web site for other things to try.

Setting Up Mouse Support

Look for the $_com1, $mouse, and $mouse_dev entries and change them as follows:

$_com1 = "/dev/mouse"
$_mouse = "microsoft"
$_mouse_dev = "/dev/mouse"

If your mouse is not on COM1, select the $comX entry corresponding to your mouse port. Set the $_mouse value according to the type of mouse you have. Most systems use a Microsoft mouse, but this value can be microsoft, mousesystems, logitech, mmseries, mouseman, hitachi, busmouse, or ps2. Start DOSemu and test your mouse application. Again, if you have problems getting the mouse to work, refer to the /etc/dosemu.conf file or the DOSemu Web site

Setting Up Modem Support

Look for the $_com2 entry and change it to read as follows:

$_com2 = "/dev/modem"

If your modem is not on COM2, select the $comX entry corresponding to your modem port. Start DOSemu and test your modem application.

Previous Lesson: Accesing DOS Partitions
Next Lesson: Updating Your Linux System



Comments - most recent first
(Please feel free to answer questions posted by others!)

Scot Rutherford     (03 May 2016, 00:16)
I am interested in running several dos programs on a windows 10 pro PC. Several programs [Lotus Agenda] and [Javelin] both use ems and xms memory of the later dos shells. Any chance these programs can be made to run on my program [even if I have to set up a dual boot Linux partition?
Noel     (20 Apr 2014, 07:17)
Good Article
Dosemu appears give much better performance on a 32 bit version of Linux than on a 64 Bit version.

The speed difference is huge between the two OS options.

I would be interested to know the reason for this.
dosman     (26 Oct 2012, 04:05)
FYI, there is an easy to install dosemu with a package already built, rpmfusion has these.
Jamie     (25 Feb 2012, 17:48)
Hi there.

I have Linux Mint 11. I put DOS on through Synaptic. Didn't work. I don't know why. So then I removed that through a terminal. Then I had a CD with DOS and put it on my computer in that fashion. Thought it was loaded properly. I typed dosemu. Then I pressed enter. Here's the error code:

[: 373: -: unexpected operator
In file included from built-in global.conf:828
from built-in global.conf:686
Error in built-in global.conf: (line 825) Disk-device/file /var/lib/dosemu/drives/d doesn't exit.
1 error(s) detected while parsing the configuration-file.

So it doesn't open. Any ideas what I have done incorrectly?

Dan     (23 Feb 2012, 16:33)
I downloaded dosemu to linux mint 9, and i just want to know why does it say that cant find root path to cdrom? And i also want to ask is there another way to make it work? I tried editing alot of files, but didnt work. Please help me!
ravi     (22 Feb 2012, 07:11)
how i run linux command in c lauguage?
harshali     (06 Jan 2012, 07:50)
i want same linux cammand run on Dos using C language PLZ help me in coding
Arthur N. Dunning III     (28 Sep 2011, 20:12)
Mr. Rankin, I am looking for information on how to install DOS programs on a DOS partition on my Linux machine. Can you offer any suggestions on where I can look on the net for such information?
Akhtarul Kabir     (12 Dec 2010, 01:32)
I am new user of Red hat Linux OS. I require help and support to learn on this OS.

Online Casino     (27 Sep 2010, 00:02)
excellent points and the details are more specific than elsewhere, thanks.

- Norman
Dimitris     (07 Sep 2010, 12:40)
Could anyone tell about 1.the reduction is speed (compared to native DOS OR under Win98 and 2. If I can use linux network during Dosemu session ?
Bob Rankin     (11 Aug 2010, 14:51)
@Chem - See the Linux Does DOS section in the navigation bar on the left side of this page.
chem cosmas     (11 Aug 2010, 13:34)
I want to learn how to work on Dos commands and what are the terms
I am a Cameroonian and I live in Cameroon.
vinoth     (08 Mar 2010, 00:31)
This is nice article for the Dosemu beginners.Good

I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.
Notify me about new comments on this page
Hide my email

Ask Bob Rankin - Free Tech Support

Copyright © by - Privacy Policy
All rights reserved - Redistribution is allowed only with permission.