FreeDOS's Linux Roots

On June 29, 2019, the FreeDOS Project turns 25 years old. That's a major milestone for any open-source software project! In honor of this anniversary, Jim Hall shares this look at how FreeDOS got started and describes its Linux roots.

The Origins of FreeDOS

I've been involved with computers from an early age. In the late 1970s, my family bought an Apple II computer. It was here that I taught myself how to write programs in AppleSoft BASIC. These were not always simple programs. I quickly advanced from writing trivial "math quiz" programs to more complex "Dungeons and Dragons"-style adventure games, complete with graphics.

In the early 1980s, my parents replaced the Apple with an IBM Personal Computer running MS-DOS. Compared to the Apple, the PC had a much more powerful command line. You could connect simple utilities and commands to do more complex functions. I fell in love with DOS.

Throughout the 1980s and into the early 1990s, I considered myself a DOS "power user". I taught myself how to write programs in C and created new DOS command-line utilities that enhanced my MS-DOS experience. Some of my custom utilities merely reproduced the MS-DOS command line with a few extra features. Other programs added new functionality to my command-line experience.

I discovered Linux in 1993 and instantly recognized it as a Big Deal. Linux had a command line that was much more powerful than MS-DOS, and you could view the source code to study the Linux commands, fix bugs and add new features. I installed Linux on my computer, in a dual-boot configuration with MS-DOS. Since Linux didn't have the applications I needed as a working college student (a word processor to write class papers or a spreadsheet program to do physics lab analysis), I booted into MS-DOS to do much of my classwork and into Linux to do other things. I was moving to Linux, but I still relied on MS-DOS.

In 1994, I read articles in technology magazines saying that Microsoft planned to do away with MS-DOS soon. The next version of Windows would not use DOS. MS-DOS was on the way out. I'd already tried Windows 3, and I wasn't impressed. Windows was not great. And, running Windows would mean replacing the DOS applications that I used every day. I wanted to keep using DOS. I decided that the only way to keep DOS was to write my own. On June 29, 1994, I announced my plans on the Usenet discussion group comp.os.msdos.apps, and things took off from there:

ANNOUNCEMENT OF PD-DOS PROJECT:

A few months ago, I posted articles relating to starting a public domain version of DOS. The general support for this at the time was strong, and many people agreed with the statement, "start writing!" So, I have...

Announcing the first effort to produce a PD-DOS. I have written up a "manifest" describing the goals of such a project and an outline of the work, as well as a "task list" that shows exactly what needs to be written. I'll post those here, and let discussion follow.

The "PD-DOS" project was so named because it was meant to exist in the "public domain". At the time, I didn't fully understand the implications of "public domain" (give up all rights to our programs), but I soon learned about other licenses we could use instead, including the GNU General Public License. After adopting the GNU GPL, I renamed "PD-DOS" to "Free-DOS" to represent the free software aspects. Later, we dropped the hyphen and became "FreeDOS".

FreeDOS's Linux Roots

To get the FreeDOS project off the ground, I shared the DOS-like utilities and commands that I had written for myself. From there, other DOS developers saw what I had done, and they contributed their own programs and utilities. Others volunteered to write new programs, such as our COMMAND.COM shell ("FreeCOM"). Pat Villani contacted me to contribute his DOS-like kernel.

But, did you know that many of those original FreeDOS utilities had their roots in Linux?

After discovering the power of Linux and the GNU core utilities, I wanted similar functionality on FreeDOS. We had the GNUish project, which was a parallel project to port UNIX and GNU command-line utilities like gawk and grep to the DOS command line. That immediately provided a resource for DOS users who wanted the flexibility of UNIX utilities from the DOS command line. But I still needed to write my own replacements for the MS-DOS commands, and I decided to use Linux as an influence.

If you look at the early versions of the FreeDOS utilities, you'll see influences from Linux. My first CLS (similar to clear on Linux) command borrowed the color features from Linux setterm. Running CLS WHITE ON BLUE would clear the screen and reset the console colors to use gray text ("white") on a plain blue background.

Sidenote: FreeDOS has the same colors as the Linux console using ncurses: 16 text colors and eight background colors. That's not a surprise, because if you're running Linux on a PC, the color range's origins are with the PC hardware. It's the same as DOS! Jim explains colors in ncurses in his December 2018 LJ article "About ncurses Colors".

You can most clearly see the Linux roots in my original FreeDOS TYPE command (similar to cat on Linux). When I wrote the first TYPE implementation, I referenced the extensive options in Linux cat, including /N to number the output lines, /S to squeeze together non-blank lines, /C to display control characters and /E to show end of lines using "$". These options are all borrowed directly from the Linux cat command, with -n to number the output lines, -s to suppress repeated empty lines, -v to show non-printing characters and -E to print "$" to mark the end of each line.

I tried to replicate some basic functionality of Linux in other parts of FreeDOS, with similar commands, such as TEE (basically the same as the Linux tee command) and TRCH (a simple implementation of Linux tr). FreeDOS HELP was meant to mimic the Linux man command, simply displaying a plain-text "Help" file in the same way man generates a formatted "Manual" page. HELP even borrowed the man environment variable conventions of HELPPATH and PAGER (man uses MANPATH and PAGER).

One early FreeDOS command that I was particularly fond of was the SPOOL print spooler that resembled UNIX's lpr. If you didn't use DOS, you may not realize that printing highlighted the single-task nature of DOS. When you printed a file, you had to wait for the entire document to print. On a dot-matrix printer, a short document only a few pages long could take several minutes to print.

The SPOOL print spooler ran in the background, and it would send data to the printer when your computer wasn't working very hard. This allowed you to start a print job and immediately get back to work! That's a small thing to Linux users who always have had a print system like lpr or CUPS, but such functionality was unheard of in DOS.

But FreeDOS Is Not Linux

I think it's great that FreeDOS has inherited certain features from Linux. We want FreeDOS to feel familiar to Linux users. In the upcoming FreeDOS 1.3 distribution, we plan to separate all UNIX-like utilities into their own package group, so they are easier to find and install. But FreeDOS is not Linux. It would be a disservice to FreeDOS to try to re-invent FreeDOS as a "mini-Linux".

Under the hood, FreeDOS is still DOS. And, that comes with a certain set of assumptions and limitations. Like any DOS, FreeDOS will remain 16-bit, and it will retain focus on a single-user command-line environment. We'll borrow certain Linux utilities for the FreeDOS command line, but we don't want to turn FreeDOS into a watered-down variant of Linux. 25 years after its inception, FreeDOS is still just DOS.

Join us in celebrating a quarter century of FreeDOS! 25 years is a major milestone for any open-source software project, and especially for a small operating system project like FreeDOS. Download and install the FreeDOS 1.2 distribution. Play your favorite DOS games or DOS applications. Any program that works on MS-DOS also should run on FreeDOS. And, you can view and edit our source code, because all FreeDOS programs are distributed under the GNU General Public License or a similar open-source software license.

Video: watch Marcel Gagné install FreeDOS on Linux! Skip ahead to about 13:30 in the video to watch Marcel install and boot FreeDOS in a virtual machine. See "Cooking With Linux (without a net): Really tiny Linux distributions, old DOS games, and more".

Jim Hall is an open source software advocate and developer, probably best known as the founder of FreeDOS. Jim is also very active in usability testing for open source software projects like GNOME. At work, Jim is CEO of Hallmentum, an IT executive consulting company that helps CIOs and IT Leaders with strategic planning and organizational development.

Load Disqus comments