Copyright (c) Hyperion Entertainment and contributors.
Difference between revisions of "AmigaOS Manual: AmigaDOS Command Examples"
Steven Solie (talk | contribs) |
Steven Solie (talk | contribs) |
||
Line 262: | Line 262: | ||
Then save the file and exit by pressing Esc,X,Return. The next time you boot or reboot, these commands are executed. When you have more commands to add, edit the file by entering RUN ED S:User-startup again. |
Then save the file and exit by pressing Esc,X,Return. The next time you boot or reboot, these commands are executed. When you have more commands to add, edit the file by entering RUN ED S:User-startup again. |
||
+ | |||
+ | == Creating an Assignment == |
||
+ | |||
+ | To Be Continued... |
Revision as of 20:13, 29 January 2014
The command examples elsewhere in this book are primarily to illustrate the proper syntax and general operation of AmigaDOS. This chapter shows you how to use the commands needed for a wide variety of common tasks.
The chapter is organized as follows:
- Basic tasks
- Occasional tasks
- Advanced tasks
Contents
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:
- Open the System drawer on your Workbench disk or partition.
- Double-click on the Shell icon.
OR
- Choose the Execute Command... item from the Workbench menu.
- 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:
- Make the Shell window from which the command or program was started the current window by clicking in it.
- 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:
- Make the Shell window from which the script was started the current window by clicking in it.
- 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.
Copying Files and Directories
When copying a single file from one place to another, you need to include only the paths for each. FROM and TO keywords are optional. For clarity, most COPY examples in this book use the TO keyword, but omit the FROM keyword.
To copy a file to an existing directory using optional keywords:
1> COPY FROM DF0: Pix/Fractal3 TO Work:Pictures
To copy the file omitting optional keywords:
1> COPY DF0: Pix/Fractal3 Work:Pictures
To copy a file and rename it at the same time, include the new file name in the TO argument:
1> COPY DF0: Pix/Fractal3 TO Work:Pictures/BestPic
To copy all the files in a directory to another directory, without copying the directory itself or the subdirectories it contains:
1> COPY DF0:Pix TO Work:Pictures
The contents of DF0:Pix are deposited in Work:Pictures, not grouped in their own directory. If Pix contained directories, they are not copied, but any .info files for drawers Pix contained are copied, making it appear at first that the drawers were copied.
To copy all the files in a directory to another directory, copying the directory itself but not the subdirectories it contains:
1> COPY DF0:Pix TO Work:Pictures/Pix
The directory Pix is created in Work:Pictures if it does not already exist. The destination directory does not have to be the same name as the source; you can copy to Work:Pictures/Fractals, for example.
To copy a complete directory and its contents to another directory, use the ALL keyword:
1> COPY DF0:Pix TO Work:Pictures/Pix ALL
Work:Pictures/Pix is a duplicate of DF0:Pix.
To copy only certain files to another directory, use pattern matching if their names are similar:
1> COPY DF0:Pix/Fractal[3-7] TO Work:Pictures/Pix
Files in DF0:Pix with names beginning in Fractal and ending in the digits 3 through 7 are copied.
To copy specific files to another directory, include all the file names. Change to the source directory first to avoid having to enter the full path for each:
1> CD DF0:Pix 1> COPY Fractal3 Julia Dragon TO Work:Pictures/Pix
When copying more than one file at once without using the TO keyword, COPY excepts the last name to be the destination directory. With whole-directory, multiple-file, and pattern matching operations, COPY outputs the names of the files copied and directories created as it executes.
Creating a User-startup File
A User-startup file is the Shell equivalent of the Workbench WBStartup drawer. It is a text file that is executed as a script by the default Startup-sequence. Place here any configuration commands, such as ASSIGNs, and the names of programs you wish to run automatically whenever you boot.
To create a User-startup file:
1> RUN ED S:User-startup
After the ED window opens, enter the commands you want on subsequent lines. For example, you can add some cache buffers to speed floppy access, add a directory of custom commands to the path, and start the screen blanker, by entering these lines:
ADDBUFFERS >NIL: DF0: 25 PATH >NIL: SYS:MyCommands ADD RUN Blanker CX_POPUP=NO SECONDS=600 ANIMATION=YES
Then save the file and exit by pressing Esc,X,Return. The next time you boot or reboot, these commands are executed. When you have more commands to add, edit the file by entering RUN ED S:User-startup again.
Creating an Assignment
To Be Continued...