An introduction to KERMIT by Yisrael Radai CONTENTS General A Step-by-Step Tutorial Speeding Up File Transfers Quick Summary Additional MS-Kermit commands Shortcuts Function-Key Correspondence Problems General Kermit is a program for transferring files between computers of all sizes over ordinary asynchronous telecommunication lines, particularly between a personal computer and a large or mini-computer, and for using a personal computer as a terminal for interactive work on a larger computer. Kermit is non-proprietary, thoroughly documented, and in wide use. The protocol and the original implementations were developed at Columbia University and have been shared with many other institutions, some of which have made significant contributions of their own. Kermit is presently available for more than 100 computers and operating systems, and additional versions are constantly under development. The main advantages of Kermit over certain other programs are: (1) that Kermit can be used with almost any computer and system, (2) that you can perform any command on the system of the personal computer (e.g. to change the default directory) from within Kermit, and (3) that it is possible to transfer a group of files having similar names by the use of "wildcard" notation or to prepare in advance a list of all the files which you wish to transfer, so that you can give a single command to transfer them all. (You can also prepare your initialization commands in advance and have them performed automatically.) This, of course, avoids the need for you to be present while Kermit is transferring files. On the other hand, Kermit is more difficult to learn and less convenient to use than the other two programs mentioned above. In the following we assume only that you have access to an IBM PC or compatible computer running under MS-DOS or PC-DOS, equipped with MS-Kermit (preferably Version 3.00 or later), with a modem (if necessary) and a communications line to another computer (usually a large computer or mini-computer), and that this other computer is also equipped with a version of Kermit for that computer. The other computer is officially referred to as the "remote" system, but in this guide we shall refer to it more briefly as the "host". (Note: Although the Kermit software is somewhat different for each computer, this will make very little difference, since the only Kermit command on the host which is essential in the following description is the SERVER command.) A Step-by-Step Tutorial 1. In order to establish communications between the two computers, first perform the command KERMIT on your PC. You will obtain a reply like: IBM-PC MS-Kermit ......... Type ? for help MS-Kermit> The "MS-Kermit>" is the internal prompt which you will get each time MS-Kermit is ready for a new command. Steps 2-3, 11-15 and 18 can be performed only when you see this prompt. (Note: If you wish to transfer files to or from a particular drive or subdirectory on your PC, you should change to that drive or directory before activating Kermit.) 2. Perform SET BA nnnn or SET SP nnnn to inform Kermit that your baud rate or speed is nnnn. (On-campus connections usually work at 9600 baud; dial-up connections depend on your modem as well as on the communications line; 2400 is a common rate.) 3. If necessary, perform SET PO n to tell Kermit to use serial port n (the default is 1, i.e. COM1). 4. Perform C (CONNECT) to connect to the host. You will see a line on the bottom of the screen in inverse video, showing information such as the baud rate, the serial communications port number, and the parity. The line starts with the characters Esc-chr: ^], meaning that whenever you wish to "escape" (return) to MS-Kermit, you must press your "escape character", which is Ctrl-] (i.e. press Ctrl and while it is depressed press also "]"; no ), followed by C (no ). The parity should be NONE. (If it is not, press Ctrl-] C, perform SET PA N and perform C again.) Note: An al- ternative to Ctrl-] C is Alt-x; since this is simpler, it is recommended. Note: The diskette or archive which contains this file may also contain a file called MSKERMIT.INI. If this file is either in a directory in your search path or in the directory from which you activate MS-Kermit, the commands in it will be executed automatically each time MS-Kermit begins execution, which can save you considerable typing. Note that this file may contain commands to perform many of the "Steps" described here. Do not copy this file to your hard disk without first checking that it fits your configuration. In particular, check the baud rate. 5. The next step depends on whether or not you're using a dial-up connection (modem), and whether your communications line is connected di- directly to the host computer or via a communications server. (a) If you are connected via a modem, type the modem's dialing command (e.g. ATDPnnnnnn), and when the modem replies that you're connected, pro- ceed as in (b)-(c). (Note: If you have an error-correcting modem and you get a connect message other than "CONNECT mmmm/REL" or "CONNECT mmmm/ARQ", your modem is not using the error correction facility.) You will be asked to type in your user name and password. (Note: These are not necessarily the same as your user name and password on the host computer(s) into which you log in.) (b) If your line to the host is via the Bridge communications server, press . You will get a prompt of the form xxx#n>. Type C xxx where xxx is the name of the computer you wish to connect to. When you get the response "CONNECTED TO ...", you can then log into the host machine as usual. (c) If you are connected directly to the host, simply press or whatever is ordinarily required to log into that computer. (Note: If the BackSpace key does not work when you are connected to the host, press Ctrl-h instead.) 6. If you wish merely to use the PC as a terminal and not to transfer files, you may begin to do so immediately. (See section "Function-key Correspondence" below.) Skip to Step 16 for instructions on returning to the PC when you are finished. Steps 6-15 concern file transfers. 7. Perform KERMIT on the host. (In the case of the VMS system at the Hebrew University, the command is CKERMIT at the time of this writing.) The prompt which you get depends on the host system, e.g. Kermit-32> for the VAX under VMS, C-Kermit> for Unix systems, Kermit-CMS> for the IBM under CMS. 8. If you wish to transfer files from the PC to the host, you are advised to perform SET WARNING ON so that if a command is given to transfer a file with the same name as an existing file on the host, the transferred file will be renamed. (On some host Kermits this command does not exist since a file will never be accepted on such hosts if another file by the same name already exists. Where the command does exist, it can usually be abbreviated to SET WA ON .) It is also advisable to perform certain other SET commands on the host Kermit, e.g. SET BLOCK 3, SET SEN PAC 2000, SET REC PAC 2000, SET WINDOW 5, each of which has the same meaning as the corresponding command on the local (PC) Kermit, as described below. Important: By default, files are assumed to be text files. If you wish to transfer a binary file (e.g. an ececutable file or an archive), you must perform the command SET FILE TYPE BINARY while in the *host* Kermit (but before performing SERVER; see Step 9). (To return to transferring text files at any time, you must return to the host and perform SET FILE TYPE TEXT outside of SERVER mode.) If you wish to transfer files to or from a particular subdirectory on the host computer, you should change to that directory now. 9. Perform SERVER (on most hosts this can be abbreviated to SER). This enables you to perform all your transfers by means of commands from MS-Kermit on the PC. 10. You will be told to escape to the local Kermit or to type your escape sequence. This means that you are to press Ctrl-] (see Step 3 above). The line in inverse video will disappear. Then press C. Or press Alt-x instead of Ctrl-] C. You will get the prompt MS-Kermit>, indicating that you are back in Kermit on the PC. (If at any time between file trans- fers you wish to return to the host, perform F and C, as described in Step 15 below.) 11. If you wish to transfer files from the host to the PC, you are advised to perform SET WA ON so that if a command is given to receive a file with the same name as an existing file on the PC, the transferred file will be renamed by adding a number to the part of the name before the dot (the new name will be mentioned in a message). (Without this command the existing file will be overwritten in some versions of MS-Kermit.) 12. If you wish to receive a file (transfer from the host to the PC), perform GE (GET). You will be asked to specify the Remote Source File, i.e. the name of the file on the host which you wish to transfer. You will then be asked to specify the Local Destination File, i.e. the name of the file as you wish it to be known on the PC disk. Note: If both names are the same, instead of specifying each name on separate lines from one another and from the GE, you may specify the name on the same line as the GE command: GE name If you specify only one name and the name on the host is longer than the maximum allowable on DOS (8 characters for the main part of the name, 3 characters for the extension), then it will be truncated to that maximum. If the name on DOS is of the form name.ext and its name on the host is the same except that a blank is used instead of a dot to separate the two parts of the name, the two names are considered to be the same and you may use this form with either a dot or a blank, i.e. GE name.ext -or- GE name ext 13. If you wish to transfer a file from the PC to the host, perform the command S (SEND): S localfilename hostfilename The local file name may not contain a blank (the host file name is unrestricted). If the host file name is the same as the local file name (except possibly for a blank in place of a dot), you may omit the host file name. 14. You can repeat Steps 12 or 13 as many times as you have files to transfer. However, see the section Shortcuts below for ways of requesting transfer of several files at once. While a file or group of files is being transferred, the following interrupts may be given (whether they work or not depends on the host): Enter simulates a timeout (resends the current packet). Ctrl-X (or simply X) halts transfer of the current file and pro- ceeds to the next one, if any. Ctrl-Z (or Z) halts transfer of the current file and all subsequent files. If the host Kermit does not recognize either Z or X, press Ctrl-E (or E), which returns you to the MS-Kermit command level. If you do not succeed in cancelling even the current file, because the host Kermit is stuck or the host system has crashed, try pressing Ctrl-C or Ctrl-Break. 15. When you have finished transferring files, type F (FINISH), LOGO (LOGOUT) or B (BYE): F Shuts down the server on the host and leaves you at the MS-Kermit prompt level. You can then perform C to connect to the host. On some hosts you will find yourself outside of Kermit; on others only outside of server mode and you will have to perform QUIT or EXIT (usually abbreviatable to Q or EX) if you wish to exit Kermit on the host. Once you are outside of Kermit, you will be at the command level of the host. You may then do any desired work on the host using the PC as a terminal. LOGO Like F, but also logs you out of the host. You can then log into an- other account on the same or another computer. If you perform LOGO, skip Steps 16-17 below. B Like LOGO, but also terminates Kermit on the PC, returning you to the DOS command level. If you perform B, skip Steps 16-18 below. (Note: If you receive an error message or get no response to these commands, see the section "Problems" at the end of this guide.) 16. You may now use the PC as a terminal. When you have finished, log out as usual. If you are using a modem, you will probably want to disconnect before logging out. This is done by typing +++ and waiting for the modem reply OK. You may the issue the hangup command ATH. (Alternatively, return to Kermit on the PC as described in the next step and then type HA.) 17. To return to Kermit on the PC, press Ctrl-] and C, or Alt-x, as described in Step 10 above. 18. To exit Kermit on the PC and return to the DOS command level, perform Q (QUIT) or EX (EXIT). Speeding Up File Transfers Information is transferred from one computer to another in units called packets. The size of the packet can make a considerable difference in the speed of file transfers. If there are no communications problems, the larger the packet size the faster the transfer. However, if the communications line is "noisy", so that the same packet must often be sent more than once, a large packet is a disadvantage. The Kermit for each computer has its own default packet size. For MS-Kermit it is 94 bytes for both sending and receiving. The host computer may have either smaller or larger defaults and there may be a difference between the default for sending and that for receiving. Before files are transferred, the two Kermits "negotiate" between themselves as to the size of the packets which will be sent. Usually, the packet size which is used is the smaller of the send size on the computer from which the file is sent and the receive size on the computer to which it is to be sent. In this case, you should (if communications are good) set the packet size to the maximum possible on both computers. For example, if you are using Version 3.xx of MS-Kermit, on which the maximum-sized packet is 2000, and if your host Kermit accepts a packet size of 2000 (either literally or replaces it by its maximum), then we suggest that you perform the following two commands when transferring files from the PC to the host: On the PC On the host --------- ----------- SET SEN PAC 2000 SET REC PAC 2000 and the following two commands when transferring from the host to the PC: On the PC On the host --------- ----------- SET REC PAC 2000 SET SEN PAC 2000 Of course, if the maximum size on the host is less than 2000, you should use that maximum. However, if (e.g. when sending from CMS) what is finally agreed on is not the minimum of the two but the receive size on the PC, then when transferring from the host to the PC it is sufficient to perform SET REC PAC 2000 on the PC, without having to perform SET SEN PAC 2000 on the host. The same holds if the default send size on the host is already 2000. Another command which will speed up transfer is SET WI n. The recom- mended value of n is 5 if the line is not too "noisy"; otherwise, a lower value is recommended. (The default is 1.) As in the case of the packet size, this parameter must also be set on the host Kermit. Because of the fact that the actual values of PAC and WI are determined by a combination of those on both computers, it is advisable to check each parameter after setting it at both "ends". (On the PC, perform STAT; on the host Kermit, try SHOW or STATUS.) Quick Summary After you have used the above instructions once or twice, probably your only problem will be remembering the order of the commands to be performed on the two computers. For this purpose it will be much faster to use the following diagram: Step IBM PC Host ---- ------ ---- 1. KERMIT 2. SET BA nnnn 3. SET PO n 4. C | ------------------>--------------- | 5. Log in 6. If no file transfer, go to Step 16 7. KERMIT 8. SET WARNING ON (if command exists) SET BLOCK 3 Speedup SET SEN PAC 2000 SET REC PAC 2000 SET WINDOW 5 9. SERVER 10. Ctrl-] C -or- Alt-x | ---------------<------------------ | 11. SET WA ON SET BL 3 Speedup SET SEN PAC 2000 SET REC PAC 2000 SET WI 5 12. GE filename 13. S filename filename 14. GE filename ..... 15. F C | ------------------>--------------- | Q (if necessary) 16. Work on host using PC as terminal Log out 17. Ctrl-] C -or- Alt-x | ---------------<------------------ | 18. Q Additional MS-Kermit Commands There are many additional commands which are performable at the MS-Kermit prompt; following are a few of the more useful ones. (Depending on which host is used, some of them may also be performable on the host Kermit and, if so, will generally give similar results on that system.) STAT Shows the current STATus, i.e. values of the parameters. If any of them needs to be altered, use the SET command. (If, instead of being at the MS-Kermit> prompt, you are currently connected to the host, i.e. if the inverse video line is visible, the same information can be obtained by pressing Ctrl-] S.) (Note: On many host Kermits, STATUS performs a different function and the command which comes closest to the above function is SHOW.) Try also the command SH (SHOW) with various parameters such as C or P. SET parameter value This command enables you to change the values of parameters. The parameters BA or SP, PO, PA, WA, SEN, REC, WI have been mentioned above. Other parameters are TE to define the terminal, and BL 3 in order to obtain a better check that the data has been transmitted faithfully. To obtain a list of all the parameters which may be set, perform "SET ?". DIR Displays the list of files in the current DOS directory. As with the DOS command DIR, the Kermit command DIR (DIRECTORY) may be followed by a path specification, including "wildcard" notation (see below), and it may be followed (after a blank) by a /W or /P. TY filename "TYpes" (i.e. displays) the specified DOS file on the screen. DEL filename DELetes the specified file from the current DOS directory. SP Shows the amount of SPace remaining on the disk. REM command With most hosts, you can prefix some commands (e.g. DIR) by REM, indicating that you wish to perform a similar command on the REMote Kermit instead of on DOS, even though you are currently within MS-Kermit. RU command Temporarily exits MS-Kermit, RUns (performs) the DOS command typed after the RU, and returns to MS-Kermit. (For example, "RU A:" changes the default drive to A: and returns.) PU PUshes the current Kermit environment onto a stack and exits MS-Kermit to the DOS command level so that you can perform as many DOS commands as you wish. To return to MS-Kermit, perform EXIT at the DOS prompt. (If, instead of being at the MS-Kermit> prompt, you are currently connected to the host, the same effect can be obtained by pressing Ctrl-] P.) H or ? Gives Help, i.e. displays the list of valid Kermit commands. A question mark may also be typed at any point within any command in order to obtain a list of the permissible continuations of that command. There are many additional commands. For details, see the file KERMIT.HLP in the MS-Kermit distribution archive and/or the book "Using MS-DOS Kermit", second edition, by Christine M. Gianone. Remark: The form of each Kermit command which appears in the above re- ferences is usually longer than the form which we use in this guide. For example, instead of C and DIR you will find CONNECT and DIRECTORY. However, since commands can always be abbreviated to any initial string which is sufficient to identify them uniquely, we have chosen to use the shortest possible forms in this guide in the case of commands to the local (PC) Kermit. Shortcuts Kermit allows a group of files to be specified in a single file specification by means of "wildcard" notation, i.e. the names may contain the characters "*" and "?". A "*" in either part of the name matches any string of characters, including no characters at all (but should not be followed by anything else in that part of the name); a "?" matches any single character (but this will not work in place of the first character of a file name). Examples: *.* All files (in the current directory). *.BAT All files having an extension of BAT. F*.* All files whose names start with F. F?X*.* All files whose names start with F and contain X in the third position. *.? All files whose extension consists of exactly one character. This notation can be used with the DIR command, but is particularly useful in the GE and S commands in order to transfer a group of files with similar names by means of a single command. With these two commands there are additional possibilities: A "#" can be used in place of the first character of a file name, and the "*" can be followed by other characters in the same part of the name. For example: #A?B*.* All files whose names contain A in the second position and B in the fourth position of the first part of the name. *X.* All files the first part of whose name ends with an X. *X*.* All files containing an X anywhere in the first part of the name. (In the case of the GE and REM DIR commands, the wildcard notation must, of course, be limited to the file notation appropriate to the host.) If the files to be transferred do not have similar names, you can still specify in advance a list of files to be transferred by preparing the list of GE and/or S commands on a DOS file, one line per command, except that in the case of the GE command, if the source and destination file names are different, you will need three lines per command, one for the GE, and one for each of the two file names. (You can also include commands other than GE and S in this file.) Such a file is called a "Take" file in Kermit terminology (also known as a "script" file). Then in place of Steps 12-14, perform TA filename where the filename after the TA is the name of the take file. (Hint: When you want to send a large number of files to the host which are not easily described by wildcard notation, one way of creating a take file is to perform DIR > filename and then to delete the sizes and dates from the desired file names (or to precede them by a ";", which turns them into comments), and to delete the entire line in case of each undesired file.) You can also place your initialization (e.g. SET and C) commands in a take file and execute them by performing TA on that file instead of performing them interactively, i.e. without the need for Steps 2-3 and 11 above. For example, this file might contain the following lines: SET BA 9600 SET PO 2 SET SET PAC 2000 SET REC PAC 2000 SET WI 5 SET WA ON SET BL 3 C To the extent that the initialization commands will always be the same on your PC, regardless of the host system and the user, it is still more convenient to write them on a file named MSKERMIT.INI in the current direc- tory or in the search path. These commands will then be performed automa- tically whenever KERMIT-MS is entered, without the need to perform even TA. One can even include commands to send strings over the serial port and to wait until a given string is received in response, and there are labels, IF, and GOTO commands. For example (what follows the ';' is a comment): :TRY_AGAIN ; This is a label to which a jump can be performed. OU ATDP 585555\13 ; Everything after "OU" is sent to the serial port ; (and modem, if connected). The "\13" simulates ; the Enter key used to terminate commands. INP 30 CONNECT ; Wait up to 30 seconds for the string "CONNECT". IF FAIL GO TRY_AGAIN ; Kermit will loop in order to retry if CONNECT ; was not received. PAU 2 ; Pause for 2 seconds. C ; Go into terminal (i.e. interactive) mode. Function-Key Correspondence When using the PC as a terminal, define your terminal to the host as a VT100 (or Visual 102, etc.) by means of the SET TE command. You will then use the following function-key correspondence when using a screen editor or performing other applications which use the function keys in the keypad (rectangle on the right side of the keyboard): VT100 IBM PC ----------------- --------------------- |PF1|PF2|PF3|PF4| | F1 | F2 | F3 | F4 | ----------------- --------------------- | 7 | 8 | 9 | - | | F5 | F6 | F7 | F8 | ----------------- --------------------- | 4 | 5 | 6 | , | | F9 | F10|S-F1|S-F2| ----------------- --------------------- | 1 | 2 | 3 |En-| |S-F3|S-F4|S-F5| | ------------| | ---------------|S-F6| | 0 | . |ter| | S-F7 |S-F8| | ----------------- --------------------- where S-Fn means Shift-Fn. For example, if on the VT100 you would ordinarily press the Enter key, press Shift-F6 on the IBM PC. Problems If, when you attempt to transfer a file, you get the message ?Unable to receive initiate-packet this may be due to any of several reasons, among which are the following: (1) Inability to find the file on the sending computer. (2) A parity mismatch; make sure that the parity is the same on both computers (preferably NONE). (3) Forgetting to (re)perform KERMIT and SERVER on the host before returning to MS-Kermit. (4) Timeout on the host computer. (5) A break in communications. If, after performing F, LOGO or B on MS-Kermit, you get a message of the form ?Unable to tell host ..... perform C in order to determine what your status on the host system is. If, instead of the prompt MS-Kermit> or the above message, you get no response, press a few times. You should then get either the above message or the MS-Kermit prompt. If, after performing GE, you get the message ?Unable to create file ... the reason may be that not enough room is left on your disk(ette) (even though the command SP or DIR tells you that you have sufficient room). When you are working on the host (i.e. when you see the inverse video line), if you get no response, try performing Ctrl-] C or Alt-x and then performing F and C from MS-Kermit again. If this doesn't work, try Ctrl-] C or Alt-x, followed by Ctrl-C from MS-Kermit.