Introduction to DOS

From ITCwiki
Revision as of 20:03, 20 September 2009 by BenFranske (talk | contribs)
Jump to navigation Jump to search

DOS, short for "Disk Operating System", is a family of similarly designed computer operating systems originally popularized by Microsoft in the early 1980s which remained in popular use through about the year 2000 as the technology underlying some versions of the Windows graphical user interface. From nearly the beginning there were competing versions of DOS available, the most popular being MS-DOS (by Microsoft) and IBM PC DOS (also originally by Microsoft). Other versions of DOS include DR-DOS, FreeDOS, PTS-DOS, ROM-DOS, JM-OS, and several others. The most popular version of DOS still under active development and maintenance is FreeDOS, an open source, MS-DOS compatible version of DOS. Despite the variety of DOS vendors the systems are generally compatible in that a program written on one version of DOS (usually MS-DOS) will usually run on any other vendor's version. One notable exception to this rule is ProDOS written for Apple II based computers which was incompatible because of underlying differences in the hardware, such as the CPU architecture.

Although DOS has largely fallen out of favor as a mainstream operating system in favor of Windows NT based operating systems it remains a useful tool for any PC technician and at least a basic understanding of DOS is still useful. In addition Windows NT based operating systems still retain a "command line interface" (CLI) which uses familiar DOS commands and conventions to accomplish many system maintenance and repair functions.

History

Early hobbyist personal computers of the late 1970s and early 1980s ran a variety of, often incompatible, operating systems. One of the most popular at the time IBM was developing their original PC was the CP/M operating system by Digital Research which, at the time, ran on the 8-bit Intel 8080 and Zilog Z80 processors. During the development of the IBM PC an operating systems was needed for the Intel 8088 processor around which the system was based. IBM initially approached then Microsoft CEO Bill Gates about developing an 8088 version of CP/M but was directed to Digital Reseach, the owner of CP/M.

For obvious cost reasons IBM was looking for a blanket license to relabel and sell CP/M as IBM PC-DOS with their new computer. Digital Research founder and owner Gary Kildall refused, holding out for a royalty based deal at which time IBM withdrew their offer and returned to Microsoft looking for an alternative operating system. This time Gates approached Seattle Computer Products about a new CP/M like operating system code named "QDOS" which stood for "Quick and Dirty Operating System" developed by Tim Paterson to test Intel 8086 hardware made by Seattle Computer Products. Gates was able to secure a nonexclusive license to QDOS in December of 1980 for $25,000 and soon after hired designer Tim Paterson to port the operating system to the IBM PC which used the less expensive Intel 8088 CPU.

Shortly before the launch of the IBM PC, in the summer of 1981, Microsoft purchased all rights for QDOS (now known as the commercial product 86-DOS) from Seattle Computer Products for $50,000. Microsoft, in-turn, licensed the IBM PC version of 86-DOS to IBM to be sold as IBM PC DOS 1.0. In a stroke of genius the license agreement between Microsoft and IBM was non-exclusive, allowing Microsoft to license the operating system to other PC manufacturers when they arrived some time later.

The original DOS was designed to look and act much like the competing CP/M operating system, and was even compatible with CP/M programs to some extent, but was much less expensive and soon overtook CP/M as the primary operating system of the personal computer.

Storage Structure

DOS uses a drive and directory based file storage system. One of the easiest ways to envision this storage system is to think of drives as file drawers in an office and directories as file folders in those drawers. Directories can be nested, that is put inside of each other, creating a sort of family tree style storage system. The main directory on each drive is called the root directory or root and is identified in DOS by a single backslash \. This directory can contain both files and other directories, referred to as sub-directories.

Each disk drive in the system is identified by a drive letter. By DOS convention the primary floppy disk drive is identified as A and the secondary as B Fixed disks (more commonly referred to today as hard disks or hard drives are identified by drive letters starting with C.

DOS uses the file allocation table (FAT) filesystem or the newer FAT32 filesystem for storing data on disks. Each file stored in this filesystem has a filename of eight characters or less without spaces (though FAT32 allows for longer filenames and spaces) and a file extension of three characters which identifies the type of file. Because some characters are used by DOS for other purposes such as identifying drives, directories, file extensions, etc. they cannot be used in filenames. The list of invalid characters includes:

. " / \ [ ] : * | < > + = ; , ?

You can pick almost any three character file extension when naming a file except three which are reserved for programs which run on your computer: COM, EXE and BAT. Although there are many possible file extensions there are some which are frequently encountered and are useful to know:

Extension File Type
BAK A backup copy of a data file
BAT A batch script program file
COM A command program file
DOC A word processor document file
EXE An executable program file
SYS A system file
TXT A text file


The DOS Prompt and Running Programs

The DOS prompt, sometimes referred to more generically as a command prompt, is the main method of interaction with DOS. It is used to execute programs, change drives, change directories, move files, list directory contents and just about everything else. The default prompt shows the currently active drive followed by a greater than sign looking something like this:

C>

One of the simplest, and most frequently done things from the command prompt is executing a program. As mentioned earlier programs which run on your computer end with one of three file extensions: COM, EXE or BAT. If you are in the directory containing the program all you need to do is enter the program's filename at the prompt and press the Enter or Return key. Programs can be run without entering the extension on the filename, DOS will automatically try to run the program you entered regardless of whether you have entered a file extension. For example, if you are in a directory which contains the Microsoft Word program you could run it by entering the command:

C> MSWORD

and pressing the Enter or Return key. This would execute, or run, the MSWORD.EXE program.

Navigating Drives and Directories

Changing Drives

DOS can only operate in one directory on one drive at a time so the ability to change the drive and working directory is important. To move from one drive to another simply enter the drive letter you wish to switch to, followed by a colon, at the prompt and press Enter or Return:

C> A:

This would switch from the C drive to the A drive. The basic prompt would also change to show the drive change. To switch back to the C drive simply enter:

A> C:

Note that you are only able to change to drives which exist and floppy drives which contain a floppy disk. Attempting to change to a drive which does not exist or an empty floppy drive will result in an error.

Changing Directories

Let's assume that we have a basic system with a root directory and a subdirectory which contains two more subdirectories:

Location Description
\ The root directory
\DOCS The DOCS directory under the root
\DOCS\WORK The WORK directory under the DOCS directory under the root
\DOCS\HOME The HOME directory under the DOCS directory under the root

To move from one directory to another we need to use the change directory command CD. Assuming that we are in the root directory of the C drive and wished to change to the DOCS directory we could enter the command:

C> CD DOCS

and press the Enter or Return key. This would change the working directory from the root (\) to DOCS (\DOCS). If we then wanted to enter the HOME directory (\DOCS\HOME) we would enter:

C> CD HOME

To return to the root directory of the current drive enter:

C> CD \

It is also possible to change directories by entering the complete path to the directory. In this way you are able to quickly move from one location to another on the drive. To move directly from the root to the WORK directory enter:

C> CD \DOCS\WORK

You can also use a special directory command to move back up one level at a time. If you are in the \DOCS\WORK directory and want to move up one level to \DOCS you can use the special ".." directory which means, effectively, one directory up.

C> CD ..

Changing the Prompt

With all this moving around from one directory to another it can be difficult to remember the working directory (the directory you're currently in). Luckily, the default prompt which shows the drive you're working on can be changed to also show the working directory. This is done using the PROMPT command. One of the most useful prompts is simply displaying the current drive and directory path. This is done by entering the command:

C> PROMPT $p$g

This will change the prompt to something like:

C:\>

which shows that you are in the root directory of the C drive, in the DOCS directory this would look like:

C:\DOCS>

Clearly, this is more useful than the standard prompt but to return to the standard prompt just enter the PROMPT command without any options:

C:\> PROMPT

which will return you to the basic prompt. The prompt command can be used with many other options to, for example, display the date and time along with the working directory but such long prompts are usually avoided because of the limited amount of area on the monitor.

Viewing Directory Contents

Another useful tool is the DIR command which allows you to list the contents of a directory, including both files and subdirectories, on the screen. To display a list of files and directories in the current working directory enter the DIR command:

C:\> DIR

Sometimes the list of files is so long that the beginning of the list scrolls off the top of the screen before you can read the filenames. To prevent this you can add the /P option to the command:

C:\> DIR /P

This will cause the system to pause after each screen and ask you to press a key to see the next screen of files. While the basic DIR command will provide you with the filenames as well as sizes, dates and times the file was created or modified it is possible to see more files on each screen by using the /W option:

C:\> DIR /W

The /W option means use a wide display, giving only the filenames. It is also possible to list the files in another directory or on another drive without switching to that drive:

C:\> DIR A:

Here the files from the root directory of the A drive will be listed without changing the working directory. The various options can also be combined:

C:\> DIR /W/P

will display files in a wide listing as well as pause between each screen of filenames.