UNDERSTANDING THE SHELL

We have seen how powerful the Workbench is. With it, we can do just tons of things. But, the Workbench was designed to be easy and elegant; not omni-potent. While many functions can be done from it, there is a much more powerful (and therefore more dangerous) way around AmigaDOS: the SHELL. The SHELL is a direct non-GUI method of commanding AmigaDOS. This interface (formerly called the CLI for COMMAND LINE INTERFACE) opens up on its own window and has no gadgets, icons, or pull down menus. If any of you have been unlucky enough to have owned or worked with PCs and MS-DOS in the past, you will feel right at home here. Many commands of MS-DOS and SHELL are similar or even the same. When SHELL is open, it will look like this: Workbench:>_ Now you must physically type in commands to interface with the system. The label before the > character is the current volume (or device) name that you are 'in'. There are a number of basic commands and principles you are going to need to know to be safe with the SHELL. First, we need to look at a device's structure, so you know how to navigate around using the SHELL. The Workbench is like a filing cabinet, right? Before you open any disks or drawers, it is like an unopened file cabinet. When you click open a disk icon you are opening one of the cabinet drawers. When you open a drawer (or directory) on that disk, it is like opening a file folder in that cabinet drawer. Then opening another drawer within that drawer is like opening a file in that file folder in the cabinet drawer, etc. This is called a DIRECTORY STRUCTURE or in the PC world a TREE. Here is a possible example of a "tree" using the Workbench disk as the 'file cabinet'. WORKBENCH | |--C |--DEVS | |-DOS DRIVERS | |-PRINTER DRIVERS | |-STANDARD | |-LASER | |-FONTS | |-DIAMOND | |-TOPAZ | |-RUBY | |-GARNET | |-LIBS |-S |-SYSTEM |-UTILITIES | |-DISK |-WBSTARTUP All the names listed above represent directories (or drawers) and all have files 'under' them. Some you might see on the Workbench, but most of them you won't (unless you select to show ALL files). In the SHELL, there is never really anything 'hidden' from view. That is part of the power of the SHELL. How you get from the 'current directory' to the directory you want to work with is called the 'path'. For instance, if you wanted to see what files were in the LASER directory, you would have to 'go' there first, then look or at least tell the SHELL where you wanted to look. That is what the PATH is for. A path should always be followed by a device name or designation is avoid confusion. For instance, in our above example, the path to the LASER directory is WORKBENCH:DEVS/PRINTER DEVICES/LASER or if your Workbench disk is in the internal drive you could use DF0: in place of WORKBENCH. Using device designations like DF0: is not only faster but if by some strange chance you have two devices of the same name there is no question what device you are working on. Navigating around using SHELL in AmigaDOS 2.0+ is quite easy. Easier, in fact, than with MS-DOS and much easier than with the old SHELL or CLI. To 'move' somewhere you need only type the path to move to. If you were in our above example, you would need only type DEVS/PRINTER DRIVERS/LASER to move to that directory. If you were on another device other than Workbench or in a different directory on the Workbench disk, you would have to use the full path including the device name (WORKBENCH:) preceding the path. You may also want to navigate a single directory at a time. Here is what a sample session might look like: WORKBENCH:>devs WORKBENCH:DEVS>printer drivers WORKBENCH:DEVS/PRINTER DRIVERS>laser WORKBENCH:DEVS/PRINTER DRIVERS/LASER> -OR- WORKBENCH:>workbench:devs/printer drivers/laser WORKBENCH:DEVS/PRINTER DRIVERS/LASER> NOTE: If you are using V1.3 or lower of the OS, then you will need to precede the path with the command CD (for CHANGE DIRECTORY). It will also work for V2.0+ but it is optional. Now you are in position to see what is in this directory. Now we are ready to look at file manipulation commands. Here we will touch on the most used commands in the SHELL. Each command will be followed by the parameters necessary to make it work. If the parameter is OPTIONAL it will be in square brackets []. If required it will be in <>. DIR [path] The most used command in the SHELL, this will display a list of all the directories and files in the specified path or the current directory if NOT specified. You can get a more expanded listing of the files by using LIST instead of directory. COPY [from path] [to path] This command will copy files from the 'from path' to the 'to path'. If no 'to path' is specified, the files will be copied to the CURRENT DIRECTORY. This command can use WILDCARDS, special symbols to tag multiple files: #? = All files without extensions #?.#? = All files ? = Replaces one character Use the '?' when you have a number of files with mostly the same letters and just one or two that are different in the same location. For instance, if you had three files in the RAM DISK called ATRAIN1, ATRAIN2, and ATRAIN3, and you wanted to copy all of them to a floppy disk, here is the command: COPY RAM:ATRAIN? DF0: Feel free to experiment by copying multiple files to your ram disk then using the next command to delete them. DELETE [path] This will remove the files specified. You may also use the optional path to delete files in a directory you are not currently in. Example, to delete the files in the above example: DELETE RAM:ATRAIN? TYPE [path] This command will display the contents of a text file to the SHELL window. Make sure that you open up your SHELL window completely to see the maximum amount of text. MAKEDIR [path] Makes a directory called at the specified path. It will NOT create an .info file so you will not be able to see it from the Workbench. If Workbench access is what you need, use CREATE DRAWER from the pull-downs menus on the Workbench. ED [path] Starts the Amiga's built-in text editor. This is like a mini-wordprocessor. This will allow you to alter a text file and save it back again. Very useful in customizing your system. More on that later. AVAIL Tells you lots of information about your system including how much memory you have/have left. CLS Clear screen. While you can call this command directly, it is much more useful in a series of commands called a 'script' file. For MS-DOS users, this is called a BATCH file. We will talk more about scripts a little later. ASSIGN [path] This is going to be one of your most used commands as you get deeper into the Amiga. This command will allow you to 'redirect' access of one device to another, allowing you to put files just about anywhere you want and still access them. For example, you have a Backgammon game on a floppy disk 'GAMMON'. You copy all the files into a directory on your hard drive so you can play it from there instead of the slower floppies. You put it on DH0: under the directory GAMES. So, you try and run the game and after it loads the main game it tries to load the data files required for play. Since the game KNEW it was on a disk called GAMMON, it tries to look at that disk for the files and gives you a requester telling you to put the disk GAMMON back in any drive. Well, you could put the disk back in and let it load the data files, but that would be defeating the purpose. Instead, let's redirect the request to the directory on the HD where the game actually is. ASSIGN GAMMON: DH0:GAMES/ Now, all subsequent calls for the disk GAMMON will go to the right place. As you may have guessed, this is one of the main tricks for getting programs to work on the hard drive that were not intended to installed there. That is enough SHELL information to get you started. There are literally hundreds of commands you can execute from the SHELL and you could see them if you get a directory of the directory named 'C' on your Workbench partition. Or, look in your manual for more commands. The SHELL is a powerful alternative to the Workbench. The SHELL and your 'C' directory are tightly interwoven and it is useful to add your own special commands to the system by copying the commands over to the 'C' directory so you may use them anywhere. Put all your compression programs like LHA and DMS here as well as your own text editors, icon editors, etc.

Happy Computing :) Ian C Fyvie (Dual Editor THe CRYPT) Back to Tutorial menu, Software menu, or THE CRYPT menu,