[Front] [Prev Chapter] [Next Chapter]

Chapter 4 - Working with Caldera DR-DOS

Memory

Disks

Commands

Working with Files and Directories

Redirection


This chapter is your starting point for using the Caldera DR-DOS(TM) operating system.

Memory

Every computer has memory to store information and to run programs. Memory stores information as patterns of 1's and 0's, called bits. A group of eight bits is called a byte. A character such as 3 or ? can be represented in one byte of memory. Because computers contain large amounts of memory, however, memory is usually referred to in terms of kilobytes (KB) and megabytes (MB); one KB is 1,024 bytes and one MB is 1,024 KB.

The memory used to run programs is referred to as Random Access Memory, or RAM for short.

Disks

Disks provide permanent storage of the programs you use on your computer and the data you accumulate as you use them.

There are several different types of disk you can use: hard disks, diskettes (floppy disks), and memory (or virtual) disks. The following sections give brief descriptions of these types of disk.

There is another type of disk called a removable disk. Examples of these are Syquest* and Bernoulli* drives.

Hard Disks

A hard disk is permanently fixed inside your computer. Hard disks are sometimes referred to as fixed disks.

Diskettes

Diskettes are removable from your computer. They are available in different sizes and capacities; 5.25-inch diskettes have capacities of 360 KB and 1.2 MB while 3.5-inch diskettes have capacities of 720 KB, 1.44 MB, and 2.88 MB.

Always handle diskettes with care.

Protecting Data on Diskettes

To prevent data being copied onto a diskette, or its contents being changed in any way, you can write-protect it.

The write-protect notch on 3.5-inch diskettes is built into the diskette. To write-protect the diskette, slide the plastic tab up so that a hole appears through the write-protect notch.

Write-protect a 5.25-inch diskette by placing a tab (usually supplied with the diskette) over the notch in the top right-hand side of the diskette. The diskette is write-protected until the tab is removed. Some 5.25-inch diskettes do not have a notch; these diskettes are permanently write-protected.

Disk Drives

You get access to a disk or diskette through a drive. A drive is identified by a letter followed by a colon. The first diskette drive is usually A:, the second diskette drive B:, and the hard disk drive is usually the C: drive. If there is more than one partition on the hard disk, each partition is assigned its own drive letter so that it can be accessed as a separate drive.

Disk Configurations

Computers usually have one of the following disk configurations:

If you have a hard disk, you will perform most of your work on the hard disk.

Memory Disks

The third type of disk, a memory disk, is not a physical disk but part of your computer's memory that the operating system treats as a disk. This is why a memory disk is also referred to as a virtual disk. Use the DR-DOS device driver VDISK.SYS to set up a memory disk; refer to Chapter 9, ``Configuring the System'' in DOSBook for information on how to do this.

A memory disk only stores data temporarily. When you switch off your computer, or reboot, any data stored in a memory disk is lost. You must use a hard disk or diskettes to store data permanently.

Preparing Disks for Use

Before you can use a hard disk, it must be formatted and partitioned. Formatting the disk enables it to store data. Partitioning the disk divides it into one or more partitions so that the operating system can store and retrieve data more easily. Also, the operating system must be installed on a primary partition.

If the hard disk manufacturer has already prepared the disk, you do not need to do it yourself. The operating system installation program detects whether your hard disk has been prepared, and gives you appropriate instructions if the hard disk is not prepared. Refer to Appendix B, ``Preparing the Hard Disk'' in DOSBook for more information.

You may also need to format diskettes before using them. Formatting divides the diskette into sections so that the operating system can store and retrieve data on the diskette. Use the FORMAT command to do this; refer to the ``Command Reference'' chapter of DOSBook for more information on FORMAT.

Commands

You use a command to make your computer carry out a particular task such as copying a file. Commands can act on specified files, groups of files, or entire disks. Command names are usually followed by options which modify the way the computer carries out the command.

The Caldera DR-DOS command set includes four different types of command: internal, external, batch file commands, and configuration commands.

The following sections describe the different types of command and how to use them.

Internal Commands

Internal commands are the commands that are loaded into memory when you start up the operating system, because they are used most frequently. They are loaded from a file called COMMAND.COM, so it is easy for the operating system to execute them. You can run internal commands whenever the system prompt is displayed.

External Commands

External commands are only loaded into memory when you run them, to save space in memory. External command files have the filename extensions .COM and .EXE. When you enter an external command at the system prompt, the operating system retrieves the appropriate command file from disk and executes it. The operating system must have access to the directory which contains the external command file.

PATH is an internal command that enables the operating system to locate external commands. Refer to the ``Command Reference'' chapter of DOSBook for a detailed description of PATH.

Batch File Commands

A file in which you store a sequence of commands you use frequently is called a batch file. You can use a batch file to start an application, for example. When you enter the name of the batch file at the system prompt, the commands in the batch file are executed one after the other, as if you are entering them separately.

The operating system provides a special set of commands to use in batch files. These batch file commands are stored the same way as internal commands, except the CHOICE command. Refer to Chapter 7, ``Batch Processing'' in DOSBook for further information.

Configuration Commands

Configuration commands are used in the file CONFIG.SYS. The operating system reads the CONFIG.SYS file every time you start your computer, and executes all the commands it finds. Many CONFIG.SYS commands are added to the CONFIG.SYS file when you install the operating system or run the SETUP program, but you can also edit CONFIG.SYS yourself. Refer to Chapter 9, ``Configuring the System'' in DOSBook for more information about the configuration commands.

Entering Commands

You enter commands at the system prompt. Whenever you see the prompt, you know that the computer is waiting for you to enter an instruction from the keyboard. The information you enter at the prompt is referred to as the command line.

If the operating system is installed on a hard disk, the default system prompt appears as follows:

[DRDOS] C:\>
This indicates that C: is the current drive. When you enter a command, the operating system always looks to the current drive. If you have installed the operating system onto diskettes, then A:\> is shown as the current drive in the system prompt.

After typing the command line, you must always press <Enter> to make the operating system carry out the instructions.

Command names are up to eight characters in length and are usually followed by options that modify the way the operating system carries out the command. For example:

DIR C:\LETTERS /2
Command options such as C:\LETTERS are known as parameters. The parameter C:\LETTERS tells the DIR command which directory's files to list. Command options with a forward slash (/) are referred to as switches. You use a switch to select a particular version of the command. The switch /2, for example, tells DIR to display the directory listing in two columns.

Punctuation is usually required to separate command names from their associated options. In general, you include a space between the command name and the options and a space between each option. You must have a space between parameters, and between parameters and switches, but you can type several switches without using a space between them. For example:

DEL C:\LETTERS\MAYLET.TXT /CS
Sometimes, other symbols are required, such as commas and colons. The MODE command, for example, looks as follows:

MODE COM1:9600,N,8,1
The ``Command Reference'' chapter of DOSBook includes the complete syntax for every operating system command as well as an explanation of the syntax.

Editing the Command Line

If you make a mistake when typing a command, you see the following message when you enter the command:

Command or filename not recognized
You may have simply mistyped the instruction or directed the command to the wrong drive (see ``Changing Drives'' below). If you make a mistake and you have not yet pressed <Enter>, you can correct the command line by pressing the <Backspace> key which erases the command line one character at a time. You can then type the command line again.

The operating system also has a powerful feature that stores commands entered previously and lets you recall them by pressing the up and down arrow keys. You can then edit and issue them again. You may have enabled this feature when you installed the operating system by setting the HISTORY option to ON. If you did not enable HISTORY, you can enable it at any time by running the SETUP program; see Chapter 9, ``Configuring the System'' in DOSBook for detailed information about using SETUP and the HISTORY option.

The ``Command Reference'' chapter of DOSBook contains a complete list of the keys you can use for command line editing. See the sections ``Command Line Editing'' and ``Extended Command Line Editing'' in the ``Command Reference'' chapter of DOSBook, the online manual.

Changing Drives

When you enter a command, the operating system always looks for that command on the current disk drive. If you want a command to operate on another drive, you change drives by entering the new drive letter followed by a colon. For example:

A: 
This changes the current drive to drive A: and the default prompt changes to:

[DRDOS] A:\>
Any command you enter now operates on the A: drive.

You can tell the operating system to look at another drive without changing the current drive by including the drive letter (and colon) when entering the command. For example:

DIR A:

Getting Online Help for Commands

You can display help text about any command and its options by entering the command followed by /? or /H.

You can also use DOSBook to obtain information about the operating system. DOSBook is an online manual. To display information about a particular command, type the following at the system prompt, where command is the command you want information about:

DOSBOOK command <Enter>

Displaying a Screenful of Data at a Time

Some commands display information that fills more than one screen; text moves off the screen (scrolls) so that you miss the first part of the information. This will happen if you enter a DIR command and the listing is very long, for example. You can suspend scrolling in any of the following ways:

Stopping Commands

You can stop a command after entering it by pressing <Ctrl> C or
<Ctrl><Break>. Command processing stops and you return to the system prompt.

Working with Files and Directories

Information stored permanently on a hard disk or diskette is organized into files. Files contain information such as programs, or the text of a letter or report.

Every file has a name to identify it and (optionally) an extension. A filename extension is separated from the filename by a period (.) and often identifies the class of the file: LETTER.TXT, for example.

Directories are a means of keeping track of your files by organizing them into groups according to contents, project names, user names, classes, and so on. Directories contain information about the files they have stored in them, including file size, time of creation, and when they were last changed. Directories can be arranged in a hierarchical structure so that they can contain other directories (subdirectories) as well as files. A directory can also have an extension to its name, but extensions to directory names are not used frequently.

Naming Files and Directories

Filenames and directory names can be up to eight characters in length. A file can have a filename extension of up to three characters. The valid characters to use are letters (A through Z) and numbers (0 through 9).

The following special characters are not valid:

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

Also note that the operating system uses special names to identify peripheral devices added to your computer called ``reserved device names.'' You should not name your files with any of these. There are also some common filename extensions that are used for particular types of files; refer to Table 4-1.

Table 4-1
Reserved Device Names and Filename Extensions

Reserved Device Name

Reserved Filename Extension

CON

.$$$

AUX or COMn

.BAK

PRN or LPT1

.BAS

LPT2

.COM

LPT3

.CPI

NUL

.EXE

CLOCK$

.SYS


Common File Commands

There are some commands that you will use very frequently with files; refer to Table 4-2.

Table 4-2
File Commands

Command

Purpose

COPY

Copies one or more files between disks, directories, and files.

DIR

Lists the files in the current directory.

MOVE

Moves one or more files between disks and directories.

DEL, ERA, DELQ, ERAQ

Deletes one or more files. DELQ and ERAQ prompt you before deleting each file.

TYPE

Displays the contents of a text file on the screen.

RENAME (REN)

Changes the name of one or more files.

PRINT

Sends a file to a printer if one is connected to your computer.


Note that DR-DOS has extended versions of COPY, DIR, and DEL. They are XCOPY, XDIR, and XDEL. The ``Command Reference'' chapter of DOSBook has detailed descriptions of these and all the commonly-used file commands.

Working with Groups of Files

To make it easier for you to use commands with files, the operating system has wildcards and filelists. Using wildcards and filelists, you can make these commands operate on more than one file at a time.

Wildcards

Use wildcards to partially specify a filename or filename extension so that several files match it. There are two types of wildcard: the question mark (?) and the asterisk (*).

The ? Wildcard
The question mark (?) matches any character in exactly the same position as the question mark. The following example shows this:

CHAPTER?.DOC matches with CHAPTER1.DOC and CHAPTER2.DOC

Therefore, you can use a single command to copy both of these files, by using the ? wildcard in the command line.

The * Wildcard
The asterisk (*) is ``shorthand'' for several question marks. The asterisk is valid from the position in which it appears to the end of the filename. The following example shows this:

CHAP*.* matches with CHAPTER1.DOC and CHAPTER2.DOC
and with CHAPMEM.FAX and CHAPFAX.BAK

WARNING: Be careful when you use wildcards. The wildcard *.*, the global wildcard, includes all files. Typing DEL *.* would delete all files in a directory. If you use the global wildcard, the operating system prompts you before executing the command. If you want prompting before you delete any files, use DELQ and ERAQ.

Filelists

A filelist is a text file that contains a list of filenames. When you use a filelist at the system prompt, the filelist name is preceded by the @ (at) symbol. This tells the command that the file immediately following the @ is a filelist, and to execute on each file named in the filelist.

Create filelists as text files. There is no limit to the number of filenames you can include, and you can use wildcards within individual filenames (but not in the filelist name). Each filename must be on a separate line or separated from other filenames by a space, tab, or comma.

For example, you could create a filelist called @MYFILE.LST containing the following:

FRED.BAT
BERT.BAT
*.DAT
Then, when you perform an operation on @MYFILE.LST such as copying it, FRED.BAT, BERT.BAT, and all files in the current directory with extension .DAT are copied.

Directory Concepts

The following is a list of concepts that you need to understand to make the most of the operating system's directory structure:

When you prepare a disk or diskette and start storing files on it, a directory is created called the root directory. It is not practical to have a large number of files in the root directory so the operating system allows you to build up hierarchical directory systems, one for each disk (or drive) on your system.

Directories created from the root directory are called subdirectories. Subdirectories can also contain other subdirectories. As you add more and more directories to the structure, it begins to grow into an inverted ``tree,'' with the root at the top and the branches growing downwards.

The directory in which you are working is considered the current directory by the operating system. When you carry out a task such as creating a file, the operating system assumes that you want to create the file in the current directory, unless you specify otherwise.

You can move around the directory structure from the root downwards, and up to the root again. You can also go directly to a subdirectory without going through intervening directories. Use the CHDIR (or CD) command to move around the directory structure; refer to the ``Command Reference'' chapter of DOSBook for a description of CHDIR (CD).

Special Directory Symbols

A directory which contains a subdirectory is known as the ``parent'' of the subdirectory. All directories except the root have a parent directory. The operating system uses special symbols to indicate the current directory and the parent of the current directory:

. means the name of the current directory.
.. means the directory above the current one (the parent directory).

These entries are automatically created by the operating system when you make a directory. When you issue a DIR command, the entries . and .. appear at the top of the listing. You cannot delete the . and .. entries in a directory.

Paths

In a tree directory structure, more than one file or directory can have the same name. For example, both the directories SALES and ACCOUNTS can contain a file called FRANCE.DOC. The operating system distinguishes between the two files called FRANCE.DOC by using a path. The path shows the operating system the route through the directory structure to the files.

Specify a path using a series of directory names, separated by backslashes (\). This traces a route through the tree structure to the desired point. When the first directory in the path is preceded by a backslash, the path begins at the root directory. Paths which begin with a directory name are taken as starting from the current directory.

When you add a filename to a path, it becomes a file specification (or filespec). The path in a file specification can contain up to 32 subdirectories but must not exceed 63 characters.

Working with Directories

There are five commands that are used specifically with directories. They are listed in Table 4-3.

Table 4-3
Directory Commands

Command

Purpose

TREE

Lists all the directories on a specified drive.

MKDIR (MD)

Creates a directory.

CHDIR (CD)

Changes your current directory.

RENDIR

Renames a directory.

RMDIR (RD)

Deletes an empty directory.

Refer to the ``Command Reference'' chapter of DOSBook for a more detailed description of all these commands.

Redirection

Redirection involves changing the way you send information to a command, or receive the result of the command. You can redirect input (what you enter at the keyboard) and output (the result of a command), which is usually sent to the screen.

Redirecting Output

To send output to a file or print device, for example, instead of the screen, use the redirection symbol >. For instance, you could store the output from a DIR command in a file by using redirection. The following command stores the current directory listing in the file MYLIST.DOC:

DIR > MYLIST.DOC <Enter>

You can also redirect the output from a command to a device, using the device name. The following command, for example, sends the current directory listing to the first parallel printer:

DIR > PRN <Enter>

Redirecting Input

You can use the redirection symbol < to make a command take its input from a file.

The following command, for example, sorts the contents of the file TELNUMS.DOC into alphabetical order:

SORT < TELNUMS.DOC <Enter>

Pipes and Filters

In order to use the output from one command as the input to another, you can use a pipe (the vertical bar |). The following command, for example, pipes the directory listing through the MORE command:

DIR | MORE <Enter>
MORE displays the listing one screenful at a time.

MORE is a special type of command, known as a filter command. Filter commands read input, act upon it and then output the result, often to the screen. The common filter commands are MORE, SORT, and FIND.

You can pipe commands through filter commands and combine them with redirection.

Refer to Chapter 16, ``Redirecting Information'' in DOSBook for more information on redirection.


[Front] [Prev Chapter] [Next Chapter]

info@caldera.com
Copyright 1997, 1998 Caldera, Inc. All rights reserved.