Previous Next Chapter

Basic Tasks

This section is oriented toward the novice Shell user, showing commands and short scripts to accomplish basic tasks. Use the commands shown as models for your own commands, substituting the names of your disks, directories, and files. To use the commands, type what appears after the prompt (usually 1>). Press Return to enter the command line you type.

Opening a Shell Window

To open a Shell window from Workbench:

  1. Open the System drawer on your Workbench disk or partition.
  2. Double-click on the Shell icon.

OR

  1. Choose the Execute Command... item from the Workbench menu.
  2. In the requester that appears, enter the command NEWSHELL.

To open another Shell window from a Shell, enter the NEWSHELL command at a Shell prompt:

1> NEWSHELL

Running Programs from the Shell

To run a program that is on the search path, enter the program name at the prompt:

1> CLOCK

To run a program that is not on the search path, enter the full path to the program:

1> Tempus:Fugit/Utils/SuperClock

To run a program that is not on the search path but is in a subdirectory of the current directory, enter the relative path to the program:

1> Utils/SuperClock

Stopping a Program

AmigaDOS commands and most Workbench programs started from the Shell can be exited, or stopped if currently running, by pressing Ctrl+C. This is important in case you need to abort a pattern matching DELETE, or to interrupt a directory listing or other lengthy process. Scripts can be stopped with Ctrl+D.

To stop a command or program that is currently running:

  1. Make the Shell window from which the command or program was started the current window by clicking in it.
  2. Press Ctrl+C.

In some cases you may need to press Return after Ctrl+C to bring back the Shell prompt.

To stop a script that is currently running:

  1. 1Make the Shell window from which the script was started the current window by clicking in it.
  2. Press Ctrl+D.

Changing the Current Directory

The current directory is normally part of the standard Shell prompt, as in 1.Workbench:>. In the following examples, notice the prompt to see how the current directory changes.

To save typing, change the current directory to the one in which you are working.

If you are issuing two or more commands that refer to things in a certain directory, make it the current directory using the CD command. The following two sets of commands both accomplish the same task:

1.Work:> COPY Storage/Keymaps/usa2 TO DEVS:Keymaps
1.Work:> DELETE Storage/Keymaps/usa2

1.Work:> CD Storage/Keymaps
1.Storage:Keymaps> COPY usa2 TO DEVS:Keymaps
1.Storage:Keymaps> DELETE usa2

Entering the second set of commands instead of the first saves over a dozen keystrokes. This savings is even greater if further work in Storage/Keymaps is needed.

To change the current directory with as little typing as possible, omit the CD command, and use the slash and colon to move though the directory structure:

1.Workbench:Devs/Monitors> /Printers
1.Workbench:Devs/Printers> :Prefs/Presets
1.Workbench:Prefs/Presets> /
1.Workbench:Prefs>

To switch quickly between two current directories, use the PCD script (located in the S: directory):

1.Workbench:> PCD Devs/DOSDrivers
1.Workbench:Devs/DOSDrivers> Extras:Storage
1.Extras:Storage> PCD
1.Workbench:>

To see the current directory, if the Shell prompt does not show it, use the CD command alone:

1> CD
Workbench:

Changing the Search Path

To create a directory on the SYS: volume for additional commands and add it to the search path for the current Shell:

1> MAKEDIR SYS:MyCommands
1> PATH SYS:MyCommands ADD

To add MyCommands to the search path, effective for the whole system, use an ASSIGN command instead of PATH:

1> ASSIGN C: SYS:MyCommands ADD

To have the Amiga look for commands in a C directory on any disk inserted in drive DF0:, use ASSIGN with the PATH option:

1> ASSIGN C: DF0: C PATH

Displaying the Contents of a Directory

To display the names of files and subdirectories in a directory use DIR:

1> DIR DEVS:
DataTypes (dir)
Monitors (dir)
DOSDrivers (dir)
Keymaps (dir)
Printers (dir)
clipboard.device DataTypes.info
DOSDrivers.info Keymaps.info
mfm.device Monitors.info
parallel.device postscript_init_ps
printer.device Printers.info
serial.device system-configuration

To display the names of files, subdirectories, and files in the subdirectories in a directory, add the ALL keyword (a partial listing of the output is shown here):

1> DIR DEVS: ALL
DataTypes (dir)
8SVX 8SVX.info
AmigaGuide AmigaGuide.info
ANIM ANIM.info
CDXL CDXL.info
FTXT FTXT.info
ILBM ILBM.info
Monitors (dir)
A2024 A2024.info

To display the names of files only, with no directories, add the FILES keyword:

1> DIR DEVS: FILES
clipboard.device DataTypes.info
DOSDrivers.info Keymaps.info
mfm.device Monitors.info
parallel.device postscript_init_ps
printer.device Printers.info
serial.device system-configuration

To display the names of files only, without .info files, use pattern matching:

1> DIR DEVS:~ (#?.info) FILES
clipboard.device mfm.device
parallel.device postscript_init_ps
printer.device serial.device
system-configuration

To display information about files that includes their size and protection bits, without date and time, use LIST with the FILES and NODATES keywords:

1> LIST DEVS:~ (#?.info) FILES NODATES
clipboard.device 6944 ----rw-d
mfm.device 6684 ----rw-d
parallel.device 4272 ----rw-d
postscript_init_ps 5014 ----rw-d
printer.device 27420 ----rw-d
serial.device 5412 ----rw-d
system-configuration 232 ----rw-d

To display information about a single file, use LIST with the path on the file:

1> LIST S:Startup-sequence
Directory "S:" on Tuesday 01-Dec-92
Startup-sequence 1360 -s--rw-d 30-Oct-92 12:00:21
1 file - 4 blocks used

To display the amount of space used by a directory and its contents, including all files in subdirectories, use the ALL keyword:

1> LIST ALL

After the contents of the current directory are listed, a summary line such as the following is displayed:

TOTAL: 113 files - 762 blocks used

Divide the number of blocks by two to get the number of kilobytes (KB).

To see information from LIST, DIR, or other commands that have scrolled off the Shell window:

Select the Shell window's zoom gadget once to switch to its alternate size, which normally fills the screen. As much of the previous output as fits fills the window. Select zoom again to restore the window to its previous size.

If the window's maximum height is not large enough to reveal the desired output, reissue the command by pressing the up arrow and then Return. Pause and resume the scrolling of the output when necessary by pressing the spacebar and backspace, respectively.

To combine the CD and DIR commands:

Create the following script and save it as S:CDD. (For an example of how to create a script, see "Creating a User-startup File" on page 8-8.)

.KEY dirpath
CD <dirpath>
DIR

Set the script's protection bit by entering PROTECT S:CDD +s. Then whenever you enter CDD followed by the path to a directory, this script makes that directory the current directory and lists its contents.

Top Previous Next Chapter