Copyright (c) Hyperion Entertainment and contributors.

AmigaDOS Introduction

From AmigaOS Documentation Wiki
Jump to navigation Jump to search
WIP.png This page is currently being updated to AmigaOS 4.x. Some of the information contained here may not yet be applicable in part or totally.

About AmigaDOS

AmigaDOS is the name given to a subsystem group of modules which give to the AmigaOS capability to handle I/O with data storage units like hard disks, SSD etc.

AmigaDOS extends AmigaOS capabilities with:

  • dos.library: the AmigaDOS core library, it gives many utility functions to manage I/O of files, directories, processes, etc...;
  • File System: an AmigaDOS (dos.library) process which handles how system organizes data on phisical memory units like hard disks, SSD, etc...;
  • CLI: Command Line Interface for user with which he can interact with AmigaDOS processes without use of GUI paradigm;

AmigaDOS provides a process that you can use, called Command Line Interface or Shell. There may be several Shell processes running simultaneously, numbered from 1 onwards. The Shell processes read commands and then execute them. To make additional Shell processes, you use the NEWSHELL or RUN commands. To remove a Shell process use the ENDSHELL command. (You can find a full description of these commands in Chapter 2).

Console Handling

You can direct information that you enter at the terminal to a Command Line Interface (Shell) that tells AmigaDOS to load a program, or you can direct the information to a program running under that Shell. In either case, console (or terminal) handler processes input and output. This handler also performs local line editing and certain other functions. You can type ahead as many as 512 characters - the maximum line length.

To correct mistakes, you press the BACKSPACE key. This erases the last character you typed. To rub out an entire line, hold down the Ctrl key while you press X. This control combination is referred to from this point on in the manual as Ctrl-X. You may also use the left and right cursor keys to move within the command line to insert or remove characters if you make a mistake.

You can also search for the most recent occurrence of a specific command by typing the command line, or the beginning of it, then pressing Shift-Up (or Ctrl-R). For instance, if you type DIR and press Shift-Up, you will be returned to the last command to perform a DIR of any directory. Pressing Shift-Down moves you to the bottom of the history buffer, leaving the cursor on a blank line.

In addition to command line editing, the Shell also provides command history, which allows you to recall previously-entered command lines, edit them, and re-enter them. This is useful when you want to repeat a command or enter several very similar commands.

The shell uses a 2K command line buffer to retain command lines. The exact number of lines varies depending on [the] lengths of the lines actually stored. When the buffer fills up, the oldest lines are lost. You access lines in the buffer through the up and down cursor keys:

up cursor Moves backwards in the history buffer (earlier lines).
down cursor Moves forwards in the history buffer (later lines).

If you type anything, AmigaDOS waits until you have finished typing before displaying any other output. Because AmigaDOS waits for you to finish, you can type ahead without your input and output becoming intermixed. AmigaDOS recognizes that you have finished a line when you press the RETURN key. You can also tell AmigaDOS that you have finished with a line by cancelling it. To cancel a line, you can either press Ctrl-X or press BACKSPACE until all the characters on the line have been erased. Once AmigaDOS is satisfied that you have finished, it starts to display the output that it was holding back. If you wish to stop the output so that you can read it, simply type any character (pressing the space bar is the easiest), and the output stops. To restart output, press BACKSPACE, Ctrl-X, or RETURN. Pressing RETURN causes AmigaDOS to try to execute the command line typed after the current program exits.

AmigaDOS recognizes Ctrl-\\ as an end-of-file indicator. In certain circumstances, you use this combination to terminate an input file. (For a circumstance when you would use Ctrl-\\, see "Understanding Device Names", below).

If you find that strange characters appear on the screen when you type anything on the keyboard, you have probably pressed Ctrl-O by mistake. AmigaDOS recognizes this control combination as an instruction to the console device (CON:) to display the alternative character set. To undo this condition, you press Ctrl-N. Any further characters should then appear as normal. You could press Esc-C to reset the console. This clears the screen and displays normal text.

The table below summarizes the editing capabilities of the Amiga's Shell interface:

Key Shell Editing Commands
left cursor Moves cursor one character to the left.
right cursor Moves cursor one character to the right.
Shift-left cursor Moves cursor to the beginning of the line.
Shift-right cursor Moves cursor to the end of the line.
Backspace Deletes the character to the left of the cursor.
Del Deletes the character highlighted by the cursor.
Ctrl-H Deletes the last character (same as BACKSPACE).
Ctrl-M Processes the command line (same as RETURN).
Ctrl-J Adds a line feed.
Ctrl-W Deletes the word to the left of the cursor
Ctrl-X Deletes the current line.
Ctrl-K Deletes everything from the cursor forwards to the end of the line.
Ctrl-Y Replaces the characters deleted with Ctrl-K.
Ctrl-U Deletes everything from the cursor backwards to the start of the line.
Space bar (or any printable character) Suspends output (stops scrolling).
Backspace Resumes output (continues scrolling).
Ctrl-C Sends a BREAK command to the current process (halts the process).
Ctrl-D Sends a BREAK command to the current script (halts the script).
Ctrl-S Suspends output.
Ctrl-Q Resumes output if it was suspended with Ctrl-S.
Ctrl-\ Closes the Shell window.

Finally, AmigaDOS recognizes all commands and argument typed in either upper or lower case. AmigaDOS displays a filename with the characters in the case used when it was created, but finds the file no matter what combination of cases you use to specify the filename.

Using the Filing System

This section describes the AmigaDOS filing system. In particular, it explains how to name, organize, and recall your files.

A file is the smallest named object used by AmigaDOS. The simplest identification of a file is by its filename, discussed below in "Naming Files". However, it may be necessary to identify a file more fully. Such an identification may include the device or volume name, and/or directory name(s) as well as the filename. These will be discussed in [the] following sections.

Naming Files

AmigaDOS holds information on disks in a number of files, named so that you can identify and recall them. The filing system allows filenames to have up to 30 characters, where the characters may be any printing character except slash (/) and colon (:). This means that you can include space ( ), equals (=), plus (+) and double quote ("), all special characters recognized by the CLI, within a filename. However, if you use these special characters, you must enclose the entire filename within double quotes. To introduce a double quote character within a filename, you must type an asterisk (*) immediately before that character. In addition, to introduce an asterisk, you must type another asterisk. This means that a file named:

A*B = C"

should be typed as follows:

"A**B = C*""

for the CLI to accept it.

Note: This use of the asterisk is in contrast to many other operating systems where it is used as a universal wild card. An asterisk by itself in AmigaDOS represents the keyboard and the current window. For example,
COPY filename TO *

copies the filename to the screen. On the Amiga, the universal wild card is #?.

When spaces are used within a file, directory, or device name, quotes are required when accessing the name. For example,

COPY "df0:My file" TO ram:

Avoid spaces before or after filenames because they may cause confusion.

Using Directories

The filing system also allows the use of directories as a way to group files together into logical units. For example, you may use two different directories to separate program source from program documentation, or to keep files belonging to one person distinct from those belonging to another.

Each file on a disk must belong to a directory. An empty disk contains one directory, called the root directory. If you create a file on an empty disk, then that file belongs to the root directory. However, directories may themselves contain other directories. Each directory may therefore contain files, or yet more directories, or a mixture of both. Any filename is unique only within the directory it belongs to, so that the file "fred" in the directory "bill" is a completely different file from the one called "fred" in the directory "mary".

This filing structure means that two people sharing a disk do not have to worry about accidentally overwriting files created by someone else, as long as they always create files in their own directories.

WARNING
When you create a file with a filename that already exists, AmigaDOS deletes the previous contents of that file. No message to that effect appears on the screen. You can also use this directory structure to organize information on the disk, keeping different sorts of files in different directories.

An example might help to clarify this. Consider a disk that contains two directories, called "bill" and "mary". The directory "bill" contains two files, called "text" and "letter". The directory "mary" contains a file called "data" and two directories called "letter" and "invoice". These subdirectories each contain a file called "jun18". [This figure] represents this structure as follows:

                       ROOT
                         |
              +----------+----------+
              |                     |
            BILL                  MARY
              |                     |
         +----+----+           +--------+--------+
         |         |           |        |        |
       TEXT     LETTER       DATA    LETTER   INVOICE
                                        |        |
                                      JUN18    JUN18
Note
The directory "bill" has a file called "letter", while the directory "mary" contains a directory called "letter". However, there is no confusion because both...are in different directories. There is no limit to the depth that you can "nest" directories.

To specify a file fully, you must include the directory that owns it, the directory owning that directory, and so on. To specify a file, you give the names of all the directories on the path to the desired file. To separate each directory name from the next directory or filename, you type a following slash (/). Thus, the full specification of the data files on the disk shown...above is as follows:

bill/text
bill/letter
mary/data
mary/letter/jun18
mary/invoice/jun18

Setting the Current Directory

A full file description can get extremely cumbersome to type, so the filing system maintains the idea of a current directory. The filing system searches for files in this current directory. To specify the current directory, you use the CD (Current Directory) command. If you have set "mary" as your current directory, then the following names would be sufficient to specify the files in that directory:

data
letter/jun18
invoice/jun18

You can set any directory as the current directory. To specify any files within that directory, simply type the name of the file. To specify files within subdirectories, you need to type the names of the directories on the path from the current directory specified.

All the files on the disk are still available even though you've set up a current directory. To instruct AmigaDOS to search through the directories from the root (top level) directory of a volume (disk or partition), you type a colon (:) at the beginning of the file description. Thus, when your file description [sic] has the current directory set to "mary", you can also obtain the file "data" by typing the description ":mary/data". Using the current directory method simply saves typing, because all you have to do is specify the filename "data".

To obtain the other files on the disk, first type ":bill/text" and ":bill/letter", respectively. Another way might be to CD or type / before the filename. Slash [(/)] does not mean "root" as in some systems, but refers to the directory above the current directory. AmigaDOS allows multiple slashes. Each slash refers to the level above. So a UNIX ../ is a / in AmigaDOS. Similarly, an MS-DOS ..\\ is a / in AmigaDOS. Thus, if the current directory is ":mary/letter", you may specify the file ":mary/invoice/jun18" as "/invoice/jun18". To refer to the files in ":bill", you could type:

CD :bill

or

CD //bill

Then you could specify any file in "bill" with a single filename. Of course, you could always use the // feature to refer directly to a specific file. For example,

TYPE //bill/letter

displays the file without your first setting "bill" as the current directory. To go straight to the root level, always type a colon (:) followed by a directory name. If you use slashes, you must know the exact numbewr of levels back desired.

Setting the Current Device

Finally, you may have many disk drives. Each [floppy] disk device has a name in the form DFn (for example DF1), where the "n" refers to the number of the device. (Currently, AmigaDOS accepts the device names DF0 to DF3.) Each individual disk is also associated with a unique name, known as a volume name (see below for more details).

In addition, the logical device SYS: is assigned to the disk you started the system up from. You can use this name in place of a disk device name (like DF0:).

The current directory is also associated with a current drive, the drive where you may find the [current] directory. As you know, prefacing a file description with a colon serves to identify the root of the current drive. However, to give the root directory of a specific drive, you precede the colon with the drive name. Thus, you have yet another way of specifying the file "data" in directory "mary", that is "DF1:mary/data". This assumes that you have inserted the disk into drive DF1. So, to reference a file on the drive DF0 called "project-report" in directory "peter", you would type "DF0:peter/project-report", no matter which directory you had set as the current one.

Note
When you refer to a disk drive or any other device, on its own or with a directory name, you should always type the colon; for example, DF1:.

This table illustrates the structure of a file description

Left of the : Right of the : Right of a /
Device name or Volume name Directory name or Filename Subdirectory name or Filename

Here are some examples of valid file descriptions.

SYS:commands
DF0:bill
DF1:mary/letter
DF2:mary/letter/jun18
DOC:report/section1/figure
FONTS:silly-font
C:cls

To gain access to a file on a particular disk, you can type its unique name, which is known as the disk's volume name, instead of the device name. For instance, if the file is on the disk "MCC", you can specify the same file by typing the name "MCC:peter/project-report". You can use the volume name to refer to a disk regardless of the drive it is in. You assign a volume name to a disk when you format it. You can also change the volume name using the RELABEL command.

A device name, unlike a volume name, is not really part of the name. For example, AmigaDOS can read a file you created on DF0: from another drive, such as DF1:, if you place the disk in that drive, assuming of course that the drives are interchangeable. That is, if you created a file called "bill" on a disk in drive DF0:, the file is known as "DF0:bill". If you then move the disk to drive DF1:, AmigaDOS can still read the file, which is then known as "DF1:bill".

Attaching a Filenote

Although a filename can give some information about its contents, it is often necessary to look in the file itself to find out more. AmigaDOS provides a simple solution to this problem. You can use the command called FILENOTE to attach an associated comment. You can make up a comment of up to 80 characters (you must enclose comments containing spaces in double quotes). Anything can be put in a file comment: the day of the file's creation, whether or not a bug has been fixed, the version number of a program, and anything else that may help to identify it.

You must associate a comment with a particular file - not all files have them. To attach comments, you use the FILENOTE command. If you create a new file, it will not have a comment. Even if the new file is a copy of a file that has a comment, the comment is not copied to the new file. However, any comment attached to a file which is overwritten is retained. To write a program to copy a file and its comment, you'll have to do some extra work to copy the comment.

When you rename a file, the comment associated with it doesn't change. The RENAME command only change the name of the file. The file's contents and comment remain the same regardless of the name change.

Understanding Device Names

Devices have names so that you can refer to them by name. Disk names such as DF0: are examples of device names. Note that you may refer to device names, like filenames, using either upper or lower case. For disks, you follow the device name by a filename because AmigaDOS supports files on these devices. Furthermore, the filename can include directories because AmigaDOS also supports directories.

You can also create files in memory with the device called RAM:. RAM: implements a filing system in memory that supports any of the normal filing system comands.

Once the RAM: device exists, you can, for instance, create a directory to copy all the commands into memory. To do this, type the following commands:

MAKEDIR ram:c
COPY sys:c TO ram:c
ASSIGN C: ram:c

You could then look at the output with DIR RAM:. It would include the direcotry "c" (DIR lists this as "c (dir)"). This would make loading commands very quick but would leave little room in memory for anything else. Any files in the RAM: device are lost when you reset the machine.

AmigaDOS also provides a number of other devices that you can use instead of a reference to a disk file. The following paragraphs describe these devices including NIL:, SER:, PAR:, PRT:, CON:, and RAW:. In particular, the device NIL: is a dummy device. AmigaDOS simply throws away output written to NIL:. While reading from NIL:, AmigaDOS gives an immediate "end-of-file" indication. For example, you would type the following:

EDIT abc TO nil:

to use the editor to browse through a file, while AmigaDOS throws away the edited output.

You use the device called SER: to refer to any device connected to the serial line (often a [modem or] printer). Thus, you would type the following command sequence:

COPY xyz TO ser:

to instruct AmigaDOS to send the contents of the file "xyz" down the serial line. Note that the serial device only copies in multiples of 400 bytes at a time. Copying with SER: can therefore appear granular.

The device PAR: refers to the parallel port in the same way.

AmigaDOS also provides the device PRT: (for PRinTer). PRT: is the printer you chose in the Preferences program. In this program, you can define your printer to be connected through either the serial or parallel port. Thus, the command sequence:

COPY xyz TO prt:

prints the file "xyz", no matter how the printer is connected.

All output sent to PRT: is translated through the printer driver selected in Preferences. The printer driver will translate standard ANSI escape codes into the specific code required by the printer. PRT: translates every linefeed character in a file to carriage return plus linefeed. Some printers, however, require files without translation. To send a file with the linefeeds as just linefeeds, you use PRT:RAW instead of PRT:.

AmigaDOS supports multiple windows. To make a new window, you can specify the device CON:. The format for CON: is as follows:

CON:x/y/width/height/[title]

where "x" and "y" are coordinates, "width" and "height" are integers describing the width and height of the new window, and "title", which is optional, is a string. The title appears on the window's title bar. You must include all the slashes, including the last one. Your title can include up to 30 characters (including spaces). If the title has spaces, you must enclose the whole description in double quotes (") as shown in the following example:

"CON:20/10/300/100/my window"

There is another window device called RAW:, but it is of little use to the general user. You can use RAW: to create a raw window device similar to CON:. However, unlike CON:, RAW: does no character translation and does not allow you to change the contents of a line. That is to say, RAW: accepts input and returns output in exactly the same form that it was originally typed. This means characters are sent to a program immediately without letting you erase anything with the BACKSPACE key. You usually use RAW: from a program where you might want to do input and output without character translation.

WARNING
RAW: is intended for the advanced user. Do not use RAW: experimentally.

There is one special name, which is * (asterisk). You use this to refer to the current window, both for input or for output. You can use the COPY command to copy from one file to another. Using *, you can copy from the current window to another window, for example,

COPY * TO CON:20/20/350/150/

from the current window to the current window, for example,

COPY * TO *

or from a file to the current window, for example,

COPY bill/letter TO *

AmigaDOS finishes copying when it comes to the end of the file. To tell AmigaDOS to stop copying from *, you must give the Ctrl-\ combination. Note that * is NOT the universal wild card.

Using Directory Conventions and Logical Devices

In addition to the aforementioned physical devices, AmigaDOS supports a variety of useful logical devices. AmigaDOS uses these devices to find the files that your programs require from time to time. (So that your programs can refer to a standard device name regardless of where the file actually is.) All of these "logical devices" may be reassigned by you to reference any directory.

The logical devices described in this section are as follows:

Logical Device Name Description Directory
SYS: System disk root directory SYS:
C: Commands directory SYS:C
L: Library directory SYS:L
S: Script directory SYS:S
LIBS: Directory for OpenLibrary() calls SYS:LIBS
DEVS: Directory for OpenDevice() calls SYS:DEVS
FONTS: Loadable fonts for OpenFonts() calls SYS:FONTS
T: Temporary workspace RAM:T

SYS:

Typical directory name: Workbench:

"SYS" represents the SYStem disk root directory. When you first start up the Amiga system [from floppy], AmigaDOS assigns SYS: to the root directory name of the disk in DF0:. If, for instance, the disk in drive DF0: has the volume name Workbench, then AmigaDOS assigns SYS: to Workbench:. After this assignment, any programs that refer to SYS: use that disk's root directory.

C:

Typical directory name: Workbench:C

"C" represents the Commands direcotry. When you type a command to the CLI (DIR, for example), AmigaDOS first searches for that command in your cuurent directory. If the system cannot find the command in the current directory, it then look for "C:DIR". So that, if you have assigned "C:" to another directory (for example, "Boot_disk.c"), AmigaDOS reads and executes from "Boot_disk:c/DIR".

L:

Typical directory name: Workbench:L

"L" represents the Library directory. This directory keeps the overlays for large commands and nonresident parts of the operating system. For instance, the disk-based run-time libraries (Aux-Handler, Port-Handler, and so forth) are kept here. AmigaDOS requires this directory to operate.

S:

Typical directory name: Workbench:S

"S" represents the Script directory. This directory contains command scripts that the EXECUTE command searches for and uses. EXECUTE first looks for the script (or batch) file in your current directory. If EXECUTE cannot find it there, it looks in the directory that you have assigned S: to.

LIBS:

Typical directory name: Workbench:Libs

IExec->OpenLibrary() looks here for the library if it is not already loaded in memory.

DEVS:

Typical directory name: Workbench:Devs

IExec->OpenDevice() looks here for the device if it is not already loaded in memory.

FONTS:

Typical directory name: Workbench:Fonts

OpenFonts() looks here for your loadable fonts if they are not already loaded in memory.

T:

Typical directory name: RAM:T

You use this directory to store temporary files. Programs such as editors place their temporary work files, or backup copies of the last file edited, in this directory. If you run out of space on a disk, this is one of the first places you should look for files that are no longer needed.

During booting

When the system is first booted, AmigaDOS initially assigns C: to the :C directory. This means that if you boot with a disk that you had formatted by issuing the command:

FORMAT DRIVE DF0: NAME "My.Boot.Disk"

SYS: is assigned to "My.Boot.Disk". The "logical device" C: is assigned to the C: directory on the same disk (that is, My.Boot.Disk:c). Likewise, the following assignments are made:

C:             My.Boot.Disk:c
L:             My.Boot.Disk:l
S:             My.Boot.Disk:s
LIBS:          My.Boot.Disk:libs
DEVS:          My.Boot.Disk:devs
FONTS:         My.Boot.Disk:fonts

If a directory is not present, the corresponding logical device is assigned to the root directory.

If you have a non-bootable hard disk (here called DH0:) and you want to use the system files on it, you must issue the following commands to the system:

ASSIGN SYS:    DH0:
ASSIGN C:      DH0:c
ASSIGN L:      DH0:l
ASSIGN S:      DH0:s
ASSIGN LIBS:   DH0:libs
ASSIGN DEVS:   DH0:devs
ASSIGN FONTS:  DH0:fonts

If your hard disk is bootable, you don't need to make these assigns since the system handles it for you.

Please keep in mind that assignments are global to all Shell processes. Changing an assignment within one window changes it for all windows.

If you want to use your own special font library, type:

ASSIGN FONTS: "Special font disk:myfonts"

If you want your commands to load faster (and you have memory "to burn"), type:

MAKEDIR ram:c
COPY sys:c ram:c ALL
ASSIGN c: ram:c

This copies all of the normal AmigaDOS commands to the RAM disk and reassigns the commands directoy so that the system finds them there. Another way to speed up AmigaDOS commands is by making them resident. See the description of the RESIDENT command.

Using AmigaDOS Commands

An AmigaDOS command consists of the command name and its arguments, if any. To execute an AmigaDOS command, you type the command name and its arguments after the Shell prompt.

When you type a command name, the command runs as part of the Command Line Interface (Shell). You can type other command names ahead, but AmigaDOS does not execute them until the current command has finished. When a command has finished, the current Shell prompt appears. In this case, the command is running interactively.

The Shell prompt is initially n> where n is the number of the Shell process. However, it can be changed to something else with the PROMPT command.

WARNING
If you run a command interactively and it fails, AmigaDOS continues to execute the next command you typed anyway. Therefore, it can be dangerous to type many commands ahead. For example, if you type

COPY a TO b
DELETE a
and the COPY command fails (perhaps because the disk is full), then DELETE executes and you lose your file.

Running Commands in the Background

You can instruct AmigaDOS to run a command, or commands, in the background. To do this, you use the RUN command. This creates a new Shell as a separate process of the same priority. In this case, AmigaDOS executes subsequent command lines at the same time as those that have been RUN. For example, you can examine the contents of your directory at the same time as sending a copy of your text file to the printer. To do this, type

RUN TYPE text_file TO prt:
LIST

RUN creates a new Shell and carries out your printing while you list your directory files on your original Shell window.

You can ask AmigaDOS to carry out several commands using RUN. RUN takes each command and carries it out in the given order. The line containing commands after RUN is called a command line. To terminate the command line, press RETURN. To extend your command line over several lines, type a plus sign (+) before pressing RETURN on every line except the last. For example,

RUN JOIN text_file1 text_file2 AS text_file +
SORT text_file TO sorted_text +
TYPE sorted_text TO prt:

If you want to start a command using RUN and then close the Shell window from which it was launched, you will have to redirect input and output. To do this use:

RUN <NIL: >NIL: command

Executing Command Files

You can also use the EXECUTE command to execute command lines in a file instead of typing them in directly. The Shell reads the sequence of commands from the file until it finds an error the end of the file. If it finds an error, AmigaDOS does not execute subsequent commands on the RUN line or in the file used by EXECUTE, unless you have used the FAILAT command. The Shell only gives prompts after executing commands that have run interactively.

Directing Command Input and Output

AmigaDOS provides a way for you to redirect standard input and output. You use the > and < symbols as commands. When you type a command, AmigaDOS usually displays the output from that command on the screen. To tell AmigaDOS to send the output to a file, you can use the > command. To tell AmigaDOS to accept the input to a program from the specified file rather than from the keyboard, you use the < command. The < and > commands act like traffic cops who direct the flow of information. For example, to direct the output from the DATE command and write it to the file named "text_file", you would type the following command line:

DATE > text_file

If you want to redirect output to a file that already exists use >>. For example, to direct the output of the TYPE command to a file that already exists use:

TYPE >>more_text original_text

The text stored in the file original_text will be appended to any text that is already stored in the file my_text. Under 2.0 and later versions of AmigaDOS, if you redirect output to a file using >> and the file does not exist, then the file will be created for you.

Interrupting AmigaDOS

AmigaDOS allows you to indicate four levels of attention interrupt with Ctrl-C, Ctrl-D, Ctrl-E, and Ctrl-F. To stop the current command from whatever it was doing, press Ctrl-C. In some cases, such as EDIT, pressing Ctrl-C instructs the command to stop what it was doing and then to return to reading more EDIT commands. To tell the CLI to stop a command sequence initiated by the EXECUTE command as soon as the current command being executed finishes, press Ctrl-D. Ctrl-E and Ctrl-F are only used by certain commands in special cases.

Note
It is the programmer's responsibility to detect and respond to these interruption flags. AmigaDOS will not kill a program by itself.

Restart Validation Process

When you first insert a disk for updating, AmigaDOS creates a process at low priority. This validates the entire structure on the disk. Until the restart process has completed this job, you cannot create files on the disk. It is possible, however, to read files.

Older versions of AmigaDOS (1.3 and earlier) do some additional processing when a disk is inserted. When the restart process completes, AmigaDOS checks to see if you have set the system date and time. To set the date and time, you use the DATE command, the SETCLOCK command or the TIME command. If you do not specify the system date, AmigaDOS sets the system date to the date and time of the most recently created file on the inserted disk. This ensures that newer versions of files have more recent dates, even though the actual time and date will be incorrect.

Commonly Used Commands

This manual describes the AmigaDOS and its commands. The Command Line Interpreter (CLI) reads AmigaDOS commands typed into a CLI window and translates them into actions performed by the computer. In this sense, the CLI is similar to more "traditional" computer interfaces: you type in commands and the interface displays text in return.

Using the Shell

To use the Shell interface, select the Shell window and type the desired Shell commands (described within this manual). The Shell window(s) may be sized and moved just like many others. To close the Shell window, type "ENDSHELL".

Not all programs or commands can be run under both the Workbench and the Shell environment. Many of the AmigaDOS commands described in Chapter 2 can be run only from the Shell.

Throughout this book, the terms "CLI" and "Shell" are used to refer to the special window where you can type in AmigaDOS. Although the terms are used to mean the same thing, there is a slight difference. Just keep in mind that the CLI and the Shell both refer to the place where you can type in AmigaDOS commands.

Some AmigaDOS Commands

Alhough all the commands that are available through the Shell are explained in deleted in Chapter 2 of this book, we have found that most users will use very few of the advanced options. Therefore we have provided a summary here showing various commands in their most common form.

The commands summarized below (along with the actual AmigaDOS command name) ask AmigaDOS to do such operations as:

  • Copy a disk (DISKCOPY)
  • Format a new disk (FORMAT)
  • Make a formatted disk bootable (INSTALL)
  • Create a CLI disk
  • Relabel a disk (RELABEL)
  • Look at the directories of a disk (DIR)
  • Get information about files (LIST)
  • Prevent a file from accidental deletion (PROTECT)
  • Get information about a file system (INFO)
  • Change a current directory (CD)
  • Set the date and time (DATE)
  • Redirect the output of a command (>)
  • Type a text file to the screen (TYPE)
  • Rename a file (RENAME)
  • Delete a file (DELETE)
  • Create a new directory (MAKEDIR)
  • Copy files on a dual-drive system (COPY)
  • Copy files on a single-drive system (COPY)
  • Find files on a disk (DIR OPT A)
  • Do something automatically at boot time (using Startup-Sequence)
  • Tell AmigaDOS where to look for certain things (ASSIGN)
  • Open a new Shell window (NEWSHELL)
  • Close an existing Shell window (ENDSHELL)

For a New User

For a new user, we suggest that you read and try each of these items in sequence. Each command that is shown below leaves a test disk in a known state so that the command that immediately follows will work exactly as shown. Later, when you are more familiar with the system, the subsection titles shown below will serve to refresh your memory.

How to Begin

Before you begin this section, be sure you have two blank, double-sided disks, and your Workbench disk. Before you begin, write protect your master disk, and write enable the blank disks. Most of the commands given below assume that you have a single-drive system; however, for [the] convenience of those with dual-drive systems, the dual-drive version of the command is occasionally given.

Commands that instruct AmigaDOS to execute are shown in the following sections, indented from the left margin. After typing each command, press the RETURN key to return control to AmigaDOS. Although the commands are all shown in capital letters, this is simply to distinguish them from the rest of the text. AmigaDOS will accept the commands in lower case as well as upper case.

In the sections that follow, the notations "DF0:" and "drive 0" refer to the disk drive that is built into the Amiga. The notation "DF1:" refers to the first external 3½-inch disk drive. (Some systems use "DF2:" to refer to the [second] external drive.)

You will occasionally see a semicolon [(;)] on a command line that you are told to type. What follows the semicolon is treated as a comment by AmigaDOS. Since AmigaDOS ignores the rest of the line, you don't need to type the comment along with the command. It is for your information only.

For most commands, you can get a very limited form of help by typing the command name, followed by a question mark (?) and pressing RETURN. It shows you the "template" of a command, containing the sequence of parameters it expects and the keywords it recognizes.

Copying a Disk

You can use this sequence to back up your system master disk or any other disk.

For a one-disk system:

   DISKCOPY FROM df0: TO df0:

For a two-disk system:

   DISKCOPY FROM df0: TO df1:

Follow the instructions as they appear. For a single-drive system, you'll be instructed to insert the master (FROM) disk. Then, as the copying progresses, AmigaDOS asks you to insert the copy (TO) disk, swapping master and copy in and out until all of the disk has been duplicated. For a two-disk system, you'll be instructed to put the master disk into drive DF0: (The built-in drive) and the copy disk onto which to copy into DF1: (the first external drive).

Remove your master disk and put your master disk in a safe place. Leave the copy write-enabled so that you can store information on it. Insert the copy you have just made into the built-in drive [(DF0:)] and reboot your system from the copy. (See "Making a Disk Bootable", below.)

 After the reboot, reenter the CLI mode again.

Formatting a Disk

To try this command, your Workbench or CLI disk copy should be in drive 0, and you should have a blank disk available.

Sometimes rather than simply copy a disk, you'll want to prepare a data disk for your system. Then later you can copy selected files to this data disk. Format your second blank disk by using the FORMAT command.

   FORMAT DRIVE df0: NAME "AnyName"

Follow the instructions. You can format disks in either drive 0 (DF0:, built into your Amiga) or an external drive.

After the format is completed, wait for the disk activity light to go off and remove the freshly formatted disk. Reinsert your Workbench. The formatted disk can now be used to hold data files. It is not bootable, however.

Making a Disk Bootable

To try this command, your Workbench disk copy should be in drive 0, and your should have your freshly formatted disk available.

A bootable disk is one that you can use to start up your Amiga following the Kickstart process. You can change a formatted disk into a bootable disk by typing the command:

   INSTALL ?

AmigaDOS responds:

   DRIVE/A,NOBOOT/S,CHECK/S

Remove your Workbench disk copy and insert the formatted disk. Then type:

   df0:

and press RETURN. AmigaDOS writes boot sectors to the disk in DF0:. Now, if you wait until the disk activity light goes out, you can then perform a full reset (Ctrl-Amiga-Amiga). When the system reboots, you will go directly into the CLI rather than into the Workbench.

Your formatted disk now contains a CLI and nothing else. This means that although you see the interpreter, it can't perform any of the commands shown in this section. A CLI needs several files before its commands can be performed. All of the command files are located in the C directory of your master disk.

Making a CLI Disk

There is another way to make a bootable disk that gives you a more useful disk in that it leaves the CLI command directories intact. Here is a step- by-step process to change a writable copy of a Workbench diskette into a CLI disk:

   1.  Copy your Workbench disk.
   2.  Open the Shell as described above.
   3.  Select the Shell window and type the command:
   RENAME FROM s/startup-sequence TO s/NO-startup-sequence

Now if you wait for the disk activity light to go off and perform a full reset, your Workbench disk copy will have become a CLI disk. To restore the Workbench, perform the rename again, but with the name sequence reversed. You see, if AmigaDOS can't find a file with the exact name "Startup-sequence" ins the "s" directory, it will enter command mode and wait for you to type a command.

Relabeling a Disk

Before you try this command, your Workbench or CLI disk copy should be in drive 0.

If, after either copying or formatting a disk, you are not satisfied with the volume name you have given it, you can change the name of the volume by using the RELABEL command:

   RELABEL df0: DifferentName

This command changes the volume of the disk in drive DF0: to "DifferentName".

Looking at the Directory

Before you try this command, your Workbench or CLI disk copy should be in drive 0.

You look at the contents of a disk with [either of] the commands:

   DIR or DIR df0:

This lists the contents of your current directory. You can list the contents of a different directory by specifying the pathname for that directory. For example, the command:

   DIR df0:c or DIR c

lists the contents of the c (directory) on drive DF0:. Directories are equivelent to the drawers you see when the Workbench screen is visible.

You can look at the directory of a different disk unit, if you have one, by specifying its name. For example:

   DIR df1:

lists the contents of a disk inserted in drive DF1:.

You can even look at the directory of a disk that isn't currently in the drive by specifying its volume name. For example, the contents of that freshly formatted disk whose name we changed can be displayed by the command:

   DIR DifferentName:

AmigaDOS will ask you to insert disk DifferentName into [any] drive so that DIR can read it and report the contents of the directory. Don't do it yet, however, because there are no files present for DIR to read. We'll add some files later.

Using the LIST Command

To try this command, your Workbench or CLI disk copy should be in drive 0.

The DIR command tells you the names of files that are in your directory. The LIST command provides additional information about those files. Type the command:

   LIST

AmigaDOS provides information about all files in the current directory, including how large each file is, the protection flags for each file, whether it is a file or a directory, and the date and time of its creation.

If you specify the name of a directory with LIST, it lists information about the files within that directory:

   LIST c

In the second column after the filename you will see the protection flags for the file. The acronym "rwed" refers to protection flags, for read, write, execute, and delete. When each flag is set, using the PROTECT command, a file is supposed to be readable, writable, executable, [and] deletable.

Using the PROTECT Command

To try this command, your Workbench or CLI disk copy should be in drive 0. This command protects (or unprotects) a file from being deleted accidentally. Try the command

   DATE >myfile
   PROTECT myfile
   LIST myfile

You will see that all of the protect flags have been set to "--------". Now if you try:

   DELETE myfile

AmigaDOS responds

   "Not deleted - file is protected from deletion"

To reenable deletion of the file, type:

   PROTECT myfile d

For more information about file protection flags, see the discussion of the PROTECT command.

Getting Information About the File System

Your Workbench or CLI disk copy should still be in drive 0. Type the command

   INFO

It tells you how much space is used and how much is free on your disks, whether they are read-only or read-write, and the name of the volume. You can make more space on the disk by deleting files. You can change the name of the volume by using the RELABEL command.

If you want to get information about a disk that isn't in your single drive at the moment, issue the command as

   INFO ?

AmigaDOS responds

   DEVICE:

AmigaDOS has loaded the INFO command from your CLI disk and shows you the template for the command. The response "DEVICE:" says that you can enter any device name to get information about it. But you don't have to type anything other than a RETURN key to have it perform the command. Remove your CLI disk and insert the disk on which you want INFO to operate. Wait for the disk activity light to go on and off. Then press RETURN. AmigaDOS gives you INFO about this other disk. This works for DIR as well as INFO.

Changing Your Current Directory

Until now, we have only stayed at the "root" or topmost hierarchical level of the disk directory. You will find more information about the directory tree structure in "Using Directories" earlier. To see the level at which you are currently positioned in your directory tree, you use the command:

   CD

To change to a different current directory, you tell the system which directory is to become the current one. For example, when you did a DIR command on DF0:, the CLI disk, you say an entry "c (dir)". If you want to make this directory the current one, you issue the command:

   CD df0:c

Now when you issue the command DIR, it shows the contents of this level of the filing system. The command CD (alone) shows you the name of your current directory. You go up to the root directory (the top level) by specifying:

   CD :

on the current volume (if you refer to your disks by volume name) or

   CD df0:

on the built-in drive.

Setting the Date and Time

You can set the AmigaDOS clock by using the DATE command:

   DATE 12:00:00 12-oct-85

Now the system clock counts up from this date and time. If your system has a battery-backed, real-time clock, you can set it using the DATE command as described followed by the command:

   SETCLOCK SAVE

The SETCLOCK SAVE command copies AmigaDOS time to the real-time clock.

Redirecting the Output of a Command

Before you try this command, your Workbench or CLI disk should be in drive 0.

Normally the output of all commands goes to the monitor screen. You can change where the system puts the output by using the redirect command ">". The forward arrow symbol means send the output towards this output filename. Here's an example:

   DATE >datefile

Execute the command so that you can use the datefile described below. This command creates (or overwrites) a file named "datefile" in your current directory.

Typing a Text File to the Screen

You can see the contents of a text file by using the TYPE command:

   TYPE datefile

This command will display whatever you have in the specified file. If you wish to stop the output momentarily to read something on the screen, press the space bar. To restart it press the BACKSPACE key. If you wish to end the TYPE command, hold down the Ctrl key, and press the C key.

Changing the Name of a File

Before you try this command, your Workbench or CLI disk copy should be in drive 0.

You can change the name of a file by using the RENAME command:

   RENAME FROM datefile TO newname

or

   RENAME dateile newname

Now use TYPE to verify that the new new refers to the same contents.

   TYPE newname

Notice that the alternate form of the command doesn't require that you use the FROM and TO. Most of the AmigaDOS commands have an alternate form, abbreviated from that shown in this tutorial section. The longer form has been used primarily to introduce you to what the command does. Be sure to examine the summary pages to familiarize yourself with the alternate command forms that are available.

Deleting Files

To try this command, your Workbench or CLI disk should be in drive 0.

You may be working on several versions of a program or text file, and eventually wish to delete versions of that file that you don't need anymore. The DELETE command lets you erase files and releases the disk space to AmigaDOS for resuse.

Note
If you DELETE files, it is not always possible to retrieve them. Be certain that you really do wish to delete them.

Here is a sample command sequence, that creates a file using the redirection command, types it to verify that it is really there, then deletes it.

   DIR >directorystuff
   TYPE directorystuff
   DELETE directorystuff
   TYPE directorystuff

To the final command in the above sequence, AmigaDOS responds:

   Can't open directorystuff

indicating that the file can't be found, because you deleted it.

Copying Files

Before you enter this command, your Workbench or CLI disk should be in drive 0.

On a dual-drive system, copying files is easy:

   COPY FROM df0:sourcepath TO df1:destinationpath

or

   COPY df0:sourcepath df1:destinationpath

On a single-drive system, copying files is a little more complex. You must copy certain files from your system diskette into the system memory. This is also called the RAM: device, or RAM disk. Copy the file(s) to the RAM disk, change your directory to the RAM disk, then copy from the RAM disk onto the destination disk. Here is a sample sequence.

Be sure your Workbench or CLI disk is in the internal disk drive. Issue the commands:

   COPY df0:c/cd ram:
   COPY df0:c/copy ram:
   CD ram:

Insert the source data disk into the drive. (For this example, copy the EXECUTE command from the Workbench or CLI disk, which is already in the drive.) Type:

   COPY df0:c/execute ram:execute
              or
   COPY df0:c/execute ram:

Remove the source disk, and insert the destination disk into the drive. The destination disk can be any Amiga disk that has been formatted. Type:

   COPY ram:execute df0:execute

The EXECUTE command has now been copied from the source disk to the destination disk.

Remove the destination disk and inset your CLI or Workbench disk again. Type:

   CD df0:

and you are back where you started. The only other command you may want to perform is:

   DELETE ram:cd ram:copy ram:execute

which releases the RAM disk memory to the system for other uses.

Creating a New Directory

You can create a new diretory (newdrawer) within the current directory by using the MAKEDIR command:

   MAKEDIR newdrawer

Now if you issue the DIR command, you will see that there is an entry for:

   newdrawer (dir)

You can also use the RENAME command to move a file from one directory (drawer) to another on the same disk:

   MAKEDIR newdrawer
   RENAME FROM newname TO newdrawer/newname

moves the file from the current directory into the newdrawer you have created. To check tht it has really been moved, issue the command:

   DIR

Then type:

   DIR newdrawer

AmigaDOS looks in the newdrawer, and shows you that the file named "newname" is there.

Is My File Somewhere on This Disk?

Before you enter this command, your Workbench or CLI disk copy should be in drive 0.

Sometimes you wish to see everything on the disk, instead of only one directory at a time. You can use the DIR command with one of its options:

   DIR OPT A

which lists all directories and subdirectories on the disk. Keep in mind the space/BACKSPACE combination to pause and restart the listing.

To get a closer look at the disk's contents, you might redirect the output to a file:

   DIR >mydiskdir ALL

Notice that the redirect-the-output command character [(>)] and filename MUST come before the list of options for the DIR command.

Now, if you wish, you can TYPE the file mydiskdir and press the space bar to pause the listing. Use the RETURN [or BACKSPACE] key to resume the listing. Or, you can use ED to view the file, as follows:

   ED mydiskdir

Use the cursor keys to move up and down in the file.

Use the key combination Esc then T <RETURN> to move to the top of the file. Such a combination can be referred to as "Esc-T", meaning Esc followed by T.

Use the key combination Esc-B <RETURN> to move to the bottom of the file.

Use the key combination Esc-M then a number <RETURN> to move to a specific line number within the file.

Use the key combination Esc-Q <RETURN> to quit without changing the file; or

Use Esc-X <RETURN> to write any changes to your file back into the original filename.

Automating the Boot Sequence

There is a file in the "S" directory on your Workbench or CLI disk called startup-sequence. This is a script file. It contains a sequence of CLI commands that AmigaDOS performs whenever you reboot the system. Also in your Workbench disk startup-sequence are LOADWB (load the Workbench program) and ENCLI which basically leaves the Workbench program in control. You can make up your own startup-sequence file using NotePad to create a custom version of an EXECUTE command sequence. The EXECUTE command summary and tutorial section has details about various commands that you can have in this file. Note that startup-sequence can also be used to auto-run a program.

Note
The startup-sequence looks for a file called s:user-startup and executes it if one is found. Whenever possible, place all your startup additions and assignments in a file called s:user-startup rather than modifying the s:startup-sequence.

Assigning a Disk

Before you enter this command, your Workbench or CLI disk copy should be in drive 0.

Occasionally, you might wish to change to a different disk and then continue your work. For example, you may have booted the system using a Workbench disk, then wish to change to a CLI disk. If the CLI disk has a directory on it that contains the executable commands you want to perform (for example, a "c" directory), you can change to that disk by using the ASSIGN command.

If you don't use ASSIGN, you will have to swap disks to get commands done. Here is an example. The intent is to change disks and begin using "mydisk:" as the main disk. Before you begin, you must first create a disk called "mydisk". To do this, make a copy of Workbench (refer to the instructions for copying a disk given at the beginning of this section). Then use the RELABEL command described earlier to change the name of the new copy to "mydisk".

   CD mydisk:

AmigaDOS responds "Insert volume mydisk into any drive". Insert it, then type:

   DIR

AmigaDOS prompts "Insert volume Workbench [or whatever the boot disk name was] into any drive". It knows, from boot time, that the DIR command is in the boot disk's "c" directory. AmigaDOS reads the DIR command, then asks "insert mydisk in any drive". Any other AmigaDOS command also results in the need for a disk swap. To avoid this, use the ASSIGN command as follows:

   ASSIGN c: mydisk:c

AmigaDOS asks "Insert volume mydisk into any drive". From now on, all commands to AmigaDOS will be sought from the command ("c") directory of mydisk and AmigaDOS won't ask for the original disk back for simple commands.

Once you've done this, you'll probably want to type:

   CD mydisk:

There are other things that AmigaDOS can assign. If you issue the command:

   ASSIGN LIST

you will see the other things as well. If you run a program that requires a serial device (modem, printer) or a parallel device (printer), AmigaDOS looks in the directory currently assigned to DEVS: to locate the device. If all the system directories are on this new main disk, you can avoid having AmigaDOS ask you to reinsert the original disk by providing a script file on your disks that reassigns all devices to that disk. The contents of this script file for a disk named "mydisk" are as follows:

   ASSIGN SYS:   mydisk:
   ASSIGN S:     mydisk:s
   ASSIGN DEVS:  mydisk:devs
   ASSIGN L:     mydisk:l
   ASSIGN FONTS: mydisk:fonts
   ASSIGN LIBS:  mydisk:libs

To create4 this script file, use the command:

   COPY FROM * TO reassign

Then type the above ASSIGN lines. After you've typed the last line, enter the key combination Ctrl-\\ which ends the file. The "*" stands for the keyboard and current CLI window, so this method of creating a file is one possible alternative to using ED or EDIT.

Once you have created the script file, you can run it by typing:

   EXECUTE reassign

Now all the ASSIGNs that the system uses are set up for "mydisk" instead of the original boot disk.

Closing Comments

Chapter 2 contains a reference section that shows the templates for each of the commands in AmigaDOS. You can look at the description for each command to find more information. Once you are familiar with the commands, and the forms in which you can use them, the quick reference listing at the end of the chapter will be useful to remind you of the commands that are available.