Help file for the Macintosh Micro Shell. Format: Name enclosed in Control-@ (=0) followed by CR. File terminated by two Control-@. Two directly following names can be used if they correspond to the same text. Copyright (C) 1998 M.J.G. Veltman All rights reserved. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation, with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. Visit the site http://www.gnu.org/licenses/fdl.html for a copy of the license. alias alias Fname The file Fname (called alias file below) contains a list of 'aliases' in the form xxx=text Program alias reads the file and passes the information to the system. Whenever the first word on a command line is the same as any of the words seen on the left side of an = sign in the alias list the text after the = sign is substituted. For example: l=ls -l leads to listing whenever l is typed. Arguments on the command line after xxx are appended after text. The alias file Fname should not be longer than 512 bytes. It is truncated to that size if longer. No nesting. Reading of an alias file erases the previous list. There is a system alias list consulted after checking the user alias list. That list has one entry, specifically the one mentioned above (l=ls -l). Unless another alias for l is specified by the user this alias for l is used. argu argu arg1 arg2 arg3 .... The arguments as provided by the system are shown. Thus expansion of * type arguments is made explicit. beep beep # Make the terminal beep # times. cat cata cat Fname1 Fname2 .... cata Fname1 Fname2 .... The data forks of the files Fname1, Fname2 etc are written sequentially to standard out (the terminal). Use the command cata if both forks are to be written. Using in- and out redirection one can send byte streams to files and ports. Typically, to print file Fname given that a printer is attached to some port, say /tty2 (the printer port), one issues the command cat Fname >/tty2 Take care that the port is properly set such as required by the printer. This notably concerns the treatment of Line-feeds (LF) and Carriage-returns (CR). Remember that in the Unix convention (used here as well) a newline is represented by a linefeed alone. Usually a printer needs both LF and CR; the point is to establish who adds the CR to any LF. That can be the port, but also the printer can often be set to do it. See stty. The cat command can also be used, for example, to check action of some terminal. Suppose from port 0 (the console) the command cat output redirection a file can be made containing input typed at the terminal. Note that also >> (appending) can be used. Also input redirection < can be used. cp Fname1 The file Fname1 is copied to standard out. cp Fname1 Fname2 Both forks of the file Fname1 are copied to Fname2. If Fname2 existed it is deleted first. Fname2 will have the same permissions and the same creation date as Fname1. cp Fname1 Fname2 .... Dirnam Files Fname1 etc are copied into directory Dirnam. Otherwise as the two-name case. The programs cat and cp have much in common. For example, the following sends characters typed at the terminal to port 3: cp >/tty3 The copying stops when either a control-D or a control-C is typed. cp Copy files, data forks only. For more information see command cp. cvt cvt expression where xxx is a numerical expression. The form of the expression must be simple: no brackets. Operations or, and, exclusive or have precedence like plus or minus. The number may be in decimal, hex, octal or binary (0x, 0y or 0z prefix). The resulting number is displayed in decimal, hexadecimal, and the least significant byte in Ascii. If xxx is not a numerical expression the Ascii value of the second character is shown (example: aX gives the ascii value of X). The operators allowed are +,-,*,/,& (and), ! (or) and !! (exclusive or). Unary minus sign and unary not (%%) are also allowed. Example: 3*-7=-21. date date date MMDDYY/HHMMSS date options # If there are no arguments the date is reported. With one numerical argument of the form as shown above (example: 121589/121300 implying 15 Dec 1989 12 h 13 m and 0 secs) the time is set to that value. With the argument -v the system creation date is reported. The other possibilities are: appearance of a number (symbolized by # above). This number is converted to a date and time, assuming that the number represents the number of seconds since Jan 1, 1980, 0 h 0m 0 s. That is the way the time is represented internally by the system. Only one long word (4 bytes) is used, which restricts the time to a range of about 136 year. The options provide for date setting and calendar use. The program enters the time setting mode. Two lines are shown, giving the actual time (Clock) and a time that can be set using the cursor keys. Actually, the keys + - < and > may be used also. Typing a left or right cursor key moves the cursor to different positions. Typing the up or down keys increases or decreases the quantity just in front of the cursor. In this way years, months, days hours, minutes and seconds can be set. If the option -s has been specified the time so selected will be set as system time (provided it is in the above mentioned range). If the option -c is specified the system time is not affected. The display can be used to identify to which day some date corresponds. This is like a calendar. If the option -n is specified the numerical representation of the time such as used by the system is shown in hex notation. This may also be toggled by typing the character # while in time setting mode. The calendar used is a slightly modified Gregorian calendar: There is no leap year if the year is not a multiple of 4; else if the year is a multiple of 3200 it is no leap year; if the year is a multiple of 400 it is a leap year; if the year is a multiple of 100 it is no leap year; The Gregorian calendar has no 3200 provision. There are some advantages to this modified calendar. First, year 0 is no leap year. Secondly the first day (Jan 1 of the year 0) happens to be a Sunday. Thirdly the accuracy is improved; the Gregorian system is off by a day after about 3000 years, while the modified system remains correct for about 500 000 years. To be specific: With this convention a year has on the average 365 + 1/4 - 1/100 + 1/400 - 1/3200 days, which is 365.24218750, that is 365 days, 5 h 48 m 45.00 sec. This differs from the official tropical year by less than a second. The tropical year is 365 days, 5 h 48 m 45.17 sec, which is 365.24218947. Thus this calendar (differing from the Gregorian by the - 1/3200) will differ by a day after more than 24*3600 = 86400 years, in fact with the above numbers after about 500 000 years. Since there are yearly variations in the earth rotation of the order of a second this is the limit of accuracy anyway. du du options Fname1 Fname2 ... Reports the number of records used by the files specified. The option -v leads to detailed specification for every one of the files. The option -r implies recursive counting, and is specifically intended for the case that Fname1 etc are directories. Then all files and all subdirectories are considered as well. The options may be stringed together. Example: du -rv / All files on the system are counted and the size in terms of records of every file is reported. This command can be used notably in connection with writing floppies. To see if a file will fit on a floppy: - check how much space left on the floppy: fcheck -c /Flop1 - check the number of records needed for the file: du Fname echo echo -n text The text is copied to standard output. If no -n is specified a newline is appended to text. Note: the routines cat, cp and echo have considerable overlap. Also echo can be used to send characters to some terminal. For example: echo -n "\L" >/tty4 is useful to make paper run out from a printer (the character Control-L is commonly understood as form-feed). eject eject This command can be used to eject a floppy. Normally one should use the umount command. This command is for the case that for some reason the floppy is in the drive but can not be mounted. exch exch command line Alternative mouse clicking in areas A or B. The system launches the process specified by 'command line' and then switches to 'the other', i.e. if the calling process is process A it is switched to process B and vice-versa. The exchange is only possible if both are operated from the same port (the console, or the external ports, modem or printer). The command line may be absent. Then a simple switch is done, leaving the exiting process idle. This is equivalent to typing Cntrl-Y. To specifically switch to A or B use exch -A exch -B The system has the alias &=exch, thus typing a command line with an & and a blank in front has the same effect. fcheck fcheck Options device Options: -c report record counts (total, free, in use). Do not check device. -n report all filenames encountered. This is useful to find files. For example, fcheck -n /Drive >Flist will produce a complete list of all filenames residing on /Drive. -t to be combined with option n. If specified only text files (defined to be files with extensions a, b, c, e, f, h, l, m, s, ic, ps, sa, pic, doc, tex and help) are listed, together with length and creation time. By comparing the file produced with that of an older date it may be possible to check on accidental loss of files (which happens on the Mac sometimes, when repairing the file system). format format Option device Format the disk on the specified device. For floppies in the internal drive (it must be in the drive and not mounted): format /Flop1 The disk is formatted, verified and an empty file system is created on that disk. A name for that volume must be specified; this may be done through the option n=. If no name specified the program will ask for one, and also provide a default (the date). Example: format n=Dumpdisk /Flop1 The device must not be mounted. If that error message appears unmount first, for example umount /Flop1 If it is a floppy disk it will be ejected. Just push it back in. fzero fzero option device An empty file system is created on the disk in the specified device. The disk must be not be mounted. There is one option that allows to specify a name: n=Name. Example: fzero n=Whatnot /Flop1 See also the command format. help help name This command shows the help information corresponding to the system program 'name' (to be found in directory /). In addition information concerning #v, #s and the prefixes 'hist' and 'time'. is included, to be obtained by typing #v etc for 'name'. To get general information specify 'system' for name. All this information is in file /usr/lib/y_help, which file may be viewed directly; there are some non-printable characters in there, namely Control-@ (=0). When viewing this file in the editor type 'Esc c' to highlight these. hi hi The last 24 commands are shown with a number associated with them. One may respond in three ways: - by typing a number as corresponding to a previous command followed by a return. Then that command will be displayed in line editing mode. The command cursor up, down, left and right can be used to position within the line, or to get the previous, c.q. the following command line. Typing return leads to execution of the line. Typing \C (Control-C) gives exit from the line editor, with no further action. - by typing a number followed by the character e followed by return. The command line in question will be executed. - by typing return. Nothing is done. hi text The text is displayed in line editing mode. Otherwise as the first case above. kill kill Kill the other process. kill A kill B Kill process A or process B. ldo ldo .... System loader. See the manual, /usr/lib/y_ldo. This contains also information about Link, the linker. lo Logout. loA Logout process A. Can be used for example to logout from the console a process run from port 1 loB Logout process B. Can be used for example to logout from the console a process run from port 1 log log option option + start logging commands from tty from which this call is made. - stop logging commands from tty from which this call is made. +a start logging all. -a stop logging all. If no option specified report logging mode. login login This program is called by the system when logging in. Should not be used directly. ls ls options List the files in the present working directory. ls options Fname1 Fname2 ... ls options Dirnam The files mentioned are shown in alphabetical order. The option -l leads to extensive listing. The option -t leads to time ordering, -s ordering with respect to file size. If -d specified list only directories and devices, no files. The option -r leads to listing of files with non-zero resource fork, including the length of that fork. Some files may be invisible (the icon not shown by the finder); in case of an extensive list this is indicated by a - just after the length. The option -i leads to listing of 'invisible' files only. The options may be stringed together. Example: ls -dls Directories are extensively listed, ordered by size. memory memory There are no parameters. Some addresses are displayed, showing memory usage. In particular, memory is asked from the memory manager, and the address returned is shown. Then that memory is returned. AppLim is the upper limit of storage that can be used. The area between AppLim and the top of area B is available for Macinitosh applications, the memory manager will hand out memory in that area. Stack use in area's A and B is at the top of these areas. The stack referred to in the memory print out is the system stack, located in the upper region. System A5 refers to the value set by the system at start, and used as a reference by many Macintosh system routines. See under 'system' for details concerning the use of Macintosh system calls as described in 'Inside Macintosh'. mfs mfs option device The disk on the specified device is verified and an empty file system is created. The disk must be not be mounted. There is one option that allows to specify a name: n=Name. Example: mfs n=Whatnot /Flop1 See also the commands format anf fzero. This command differs from fzero only in that the disk is verified first. mkdir mkdir Dirnam The directory with name Dirnam is created. mount mount The mount table is printed. mount Device Dirnam Devices, from a user point of view, are /Drive The part of the device where the system was launched. /HDrive The disk from which the system was launched. /Flop1 The build-in floppy unit. /Flop2 A possible external floppy. /Xdrive# #=1-3. Used if external hard drives. /Udrive# #=1-3. Used if the system encounters some new device. Usually /Drive and /HDrive will be the build-in hard disk. All this depends on some number assigment by the Macintosh system, and may vary as they change around. Mostly one will deal with the build-in floppy; to mount it (after inserting a disk): mount /Flop1 /mnt In normal operation the build-in hard drive is associated with the devices /Drive and /HDrive, mounted on directories /usr and /HD. If the hard disk (whose root, i.e. the first, directory should be reserved for Macintosh stuff) contains the directory /HD/usr, and if the system was launched there then /usr will in fact refer to /HD/usr. The directory /HD has been introduced mainly to make the root directory accessible. ps ps Shows the processes in execution with some information, notably the pid number. ps # Shows the momentary PC and register values of the process with pid #. Of use with suspended or looping programs. ps + Shows the momentary PC and register values of all processes. pwd pwd Report the present working directory. resume resume resume A resume B Resume other process, process A or process B respectively. This refers to previously suspended processes. rm rm options Fname1 Fname2 ... Files Fname1 etc are deleted. By default no directories are removed, and the number of files deleted is reported at the end. Options: -v Veto. Permission is asked before actually deleting the file(s). -r Recursive. Also directories are removed, and the files in those directories, recursively. Before any directory is removed explicit permission is asked. -q Relevant if also option r was specified. Do not ask permission when removing a directory. -s Silence. Do not report how many files were deleted. The options may be stringed together. Thus rm -rv Fname1 Fname2 ... implies the recursive and veto option. scrt scrt ckeys Crtnam Comnam Important special case: scrt --. See below. Ckeys may be absent. They may be used to inform the system of the sequences generated when typing the cursor movement keys. The notation is for the cursor up key: "u=sequence" where sequence is whatever the cursor up key emits. At most 6 characters. Control characters must, as usual, be indicated by preceeding them with a backslash (\). Similarly d, l and r for the cursor down, left and right movements. Example: scrt "u=\[[A" "d=\[[B" "l=\[[D" "r=\[[C" which are actually the standard ascii sequences. Remember that Control-[ is escape. The file Crtnam supposedly contains a terminal description (crt.sa type file, see /usr/lib/Crt.sa for more details). The file is read and the parameters are stored by the system for use with ldo in debug mode and both the screen editor V and the command line editor. That file must be in the correct format. The file Comnam supposedly contains a command table for use by the editor (com.sa type file). The pathname is stored by the system and the editor may retrieve it. The following extra options are provided. - If only one name is specified (scrt xxxx) then the system will try to open the files /usr/lib/Crt_xxxx.sa and /usr/lib/Com_xxxx.sa and use those. - If either Crtnam or Comnam cannot be opened then the system will as above attempt with /usr/lib/Crt_ or /usr/lib/Com_ prefixed and .sa appended. - If the systems use of a Com.sa type file is to be inhibited use - as argument (scrt -). - If Com.sa is to be set but not Crt.sa substitute a + for Crtnam above. In any case, if the full path is specified for Crtnam (Comnam) then no prefixing is done. If only one full pathname is given then only Crt.sa is understood. All this amounts to the following. If for a given type terminal (say wyse) the Crt and Com files have been placed in the library (Crt_wyse.sa and Com_wyse.sa) then the call scrt wyse is sufficient to load the necessary information. If Crt of one terminal (say wyse) is to be used and Com from another (say Tvi) then the call scrt wyse Tvi will do. If only Crt is to be set use the full pathname: scrt /usr/lib/Crt_wyse.sa If only Com is to be set use a + as first argument: scrt + /usr/lib/Com_wyse.sa If Com is to be restored to default use a -: scrt - If both Com and Crt must reset to default: scrt -- The latter command may be useful to ascertain, operating from the console, that the editor etc. work properly. sdmp sdmp # Cnt The number # is interpreted as an address. The memory content at that address is dumped to standard out. Cnt, which may be absent, is a number specifying the number of bytes to be dumped. Default is Cnt=16. set set ut=# At the right hand side of the screen various times are shown. These are normally updated every second. This may be reset to another interval with the ut option. For example, set ut=10 makes the update interval 10 seconds. If there are no arguments then the system resets to the default value, i.e. update every second. showt showt Fname1 Fname2 ... Shows the Macintosh type associated with the file (TEXT etc.). A hexadecimal display is shown as well, to deal with non-printable types. shutdown shutdown This command shuts the system down. Must be in superuser mode. stty stty parameters This command may be used to set or reset the options in effect for the port used as input. Also the default settings (in effect at login) may be set. This is done (in addition to whatever else) if the word 'fix' appears as argument. If no parameters are specified the terminal driver settings are reported. Else they are set according to the parameters. With input redirection (example: stty -raw Name The data fork of Name contains byte with X echo -n "X" >.Name The resource fork contains 129 bytes, last byte X echo -n "X" >..Name The resource fork has one byte, X. At startup the command file /usr/bin/.Sysinit is executed. In particular commands adapting the ports to terminals may be specified in that file (with stty fix ...., see stty for more details). After that one may login; the file .Init in the home directory is executed. Here one may specify the files to be used by debugger and editor describing the terminal (the Crt.sa and Com.sa files). This procedure has been simplified as much as possible; see the information concerning the command scrt. The following characters have special meaning: * used as wildcard. In a command line the arguments are checked for this and compared with possible filenames. Restriction: can be used only for the last part of a filename. Thus /usr/*/Xax is not allowed, but /usr/bin/* is acceptible. \C (i.e. Control-C) leads to abortion. \Y (i.e. Control-Y) leads to switching of processes. > < can be used for output, input and error redirection. >> gives output redirection and append. Example: the command stty changes normally the settings of the terminal which is the actual input port. By redirecting input other ports may be set: stty 9600 or >> sign. Standard error is always the terminal itself. There is one command line prefix, 'time' for timing purposes. Call help with argument time for more information. Command files. A command may be the name of a file containing a list of commands. The file must be executable, use chmod if necessary (chmod 0777 fname). The commands in that file must not be further command files. One may however branch to another command file by specifying that command file with a + in front. Example: umount /mnt cd +.Init After unmounting and changing directory to the home directory the file .Init is executed. To transmit parameters the $ sign may be used. For example, let the content of command file Com be the line: echo A$1B $2 Hh X$r3Y Now issue the command: Com aa bb cc dd ee ff Then aa is the first argument and substituted for $1, bb for $2 etc. The notation $r3 refers to argument 3 and all following. Then the command that results and will be executed is: echo AaaB bb Hh Xcc dd ee ffY time time command The prefix 'time' causes the system to measure the time taken to execute the command. That time is reported at termination. Example: time ls -l will list files and then print the time used. Also within a command file this may be used. umount umount Dirnam Unmounts directory Dirnam. Instead of Dirnam one may also mention the device name. waitr waitr Issues a line of output and waits till some response is given.