# [
Command:        [ - test for a condition
Syntax:         if [ expr ]
Flags:          (none)
Example:        if [ -f file ]          # Test if file is readable

     [ is a link to the file 'test', used to improve the clarity of scripts.
Test checks to see if files exist, are readable, etc.  and returns an exit
status of zero if true and non-zero if false.  The legal operators are:

        -r file         true if the file is readable
        -w file         true if the file is writable 
        -f file         true if the file is not a directory
        -d file         true if the file is a directory
        -s file         true if the file exists and has a size > 0
        -t fd           true if file descriptor fd (default 1) is a terminal
        -z s            true if the string s has zero length
        -n s            true if the string s has non-zero length
        s1 = s2         true if the strings s1 and s2 are identical
        s1 != s2        true if the strings s1 and s2 are different
        m -eq m         true if the integers m and n are numerically equal

     The operators -gt, -ge, -ne, -le, -lt may be used as well.  These operands
may be combined with -a (Boolean and), -o (Boolean or), ! (negation).  The 
priority of -a is higher than that of -o.  Parentheses are permitted, but must 
be escaped to keep the shell from trying to interpret them.
     If test is linked to /usr/bin/[ structures such as if [ -f file ] can be
used to improve clarity.

# animals
Command:        animals - twenty questions type guessing game about animals
Syntax:         animals [database]
Flags:          (none)
Examples:       animals                 # Start the game

     Animals is a guessing game.  The user picks an animal and the computer 
tries to guess it by posing questions that should be answered by typing 'y' 
for yes and 'n' for no.  Whenever the computer loses, it asks some questions 
which allow it to improve its data base, /usr/lib/animals, so that as time
goes on it learns.

     Files used: /usr/lib/animals

# ar
Command:        ar - archiver
Syntax:         ar [dmpqrtx][abciluv] [posname] archive file ...
Flags:          (none)
Examples:       ar r libc.a sort.s      # Replace sort.s in libc.a
                ar rb a.s libc.a b.s    # Insert b.s before a.s in libc.a

     Ar allows groups of files to be put together into a single archive.  It 
is normally used for libraries of compiled procedures.  The following keys are 
allowed: 
        d: delete.  Ar will delete the name members.
        m: move named files.  Ar expects 'a', 'b', or 'i' to be specified.
        p: print the named files (list them on standard output)
        q: quickly append to the end of the archive file.
        r: replace (append when not in archive).
        t: print the archive's table of contents.
        x: extract

The keys may optionally concatencated with one or more of the following:
        a: after 'posname'
        b: before 'posname'
        c: create (suppresses creation message)
        i: before 'posname'
        l: local temporary file for work instead of /tmp/ar.$$$$$
        u: replace only if dated later than member in archive
        v: verbose

     This is used in the Intel versions of Minix only.
 
# ascii
Command:        ascii - strip all the pure ASCII lines from a file
Syntax:         ascii [-n] [file]
Flags:          -n      Extract the lines containing non-ASCII characters
Examples:       ascii file >outf        # Write all the ASCII lines on outf
                ascii -n <file >outf    # Write non-ASCII lines to outf

     Sometimes a file contains some non-ASCII characters that are in the way.  
This program allows the lines containing only ASCII characters to be extracted 
from the file.  With the -n flag, the non-ASCII lines are extracted.  No matter
whether the flag is used or not, the program returns an exit status of true if 
the file is pure ASCII, and false otherwise.

# asld
Command:        asld - assembler-loader 
Syntax:         asld [-d] [-s] [-o name] file ...
Flags:          -L      a listing is produced on standard output
                -T      used to specify a directory for the temporary file
                -i      use separate I & D space (64K + 64K) 
                -o      output goes to file named by next argument
                -s      a symbol table is produced on standard output
Examples: asld -s file.s                # Assemble file.s and list symbols
          asld -o output.s              # Assemble file.s, put binary on output
          asld -T. file1.s file2.s      # Use current directory for
                                        # temporary file

     Asld is the MINIX assembler and loader combined.  It accepts a language 
similar to that accepted by the PC-IX assembler.  Symbols are made up of 
letters, digits and underscores.  The machine instructions and addressing 
modes are the same as those used by PC-IX, except that modes using multiple 
registers are written like this example: mov ax,(bx_si).  Constant operands 
are denoted by a number sign.  Local labels are permitted in the usual UNIX 
style: the instruction jmp 1f jumps forward to the closest label 1: 
     The pseudoinstructions accepted by the assembler are listed below:
        .align n        Align to a multiple of n bytes
        .ascii str      Assemble a string
        .asciz str      Assemble a zero-terminated string
        .bss            What follows goes in the bss segment
        .byte n         Assemble one or more bytes
        .data           What follows goes in the data segment
        .define sym     Export sym from the file
        .errnz n        Force error if n is non-zero
        .even           Align to an even address
        .extern sym     Declare sym external
        .globl sym      Same as extern
        .long n         Assemble n as a long
        .org adr        Set address within current segment
        .short n        Assemble n as a short
        .space n        Skip n bytes
        .text           What follows goes in the text segment
        .word n         Assemble n as a word
        .zerow n        Assemble n words of zeros

     In the above pseudoinstructions, adr is an expression yielding a machine 
address, n is a numeric expression, str is a quoted string, and sym is a 
symbol.  The library /usr/lib/libc.a is a packed archive of assembly code.  To 
see some examples of it, extract some files from the archive with ar and then 
use the filter libupack to convert them to readable ASCII.  
     MINIX does not use .o files.  Compiler output is packed assembly 
language, as are the modules in an archive.  This scheme requires reassembling 
archive modules all the time, but it saves precious diskette space.
     Files of type .x are .s files that need C-preprocessing.

# ast
Command:        ast - add a symbol table to an executable file
Syntax:         ast [-xX] [objfile1] [symfile]
Flags:          -x      do not preserve local symbols
                -X      preserve local symbols, except for those starting
                        with 'I' which are compiler-generated
Examples:       ast     # Add default symbol table file symbol.out to
                        # default object file a.out

     Ast adds the symbol table produced by the -s option of asld to the  
executable file.  If no file is given, 'a.out' is assumed.  If no symbol table
file is listed, the default name 'symbol.out' is used.  When one file is given,
it must be the executable.  The symbol table can be generated by the command:

        cc -s file.c >symbol.out.

     This is used in the Intel versions of Minix only.

# at
Command:        at - execute commands at a later time
Syntax:         at time [month day] [file]
Flags:          (none)
Examples:       at 2315 Jan 31 myfile   # Myfile executed Jan 31 at 11:15 pm
                at 0900                 # Job input read from stdin
                at 0711 4 29            # Read from stdin, exec on April 29

     At prepares a file to be executed by atrun at the specified time.  It does
this by creating a special file in /usr/spool/at.  The name of this file is
is YY.DDD.HHMM.UU, where YY, DDD, HH, and MM give the time to execute the
command and UU is a unique number.  Note that when the command runs, it 
will not be able to use standard input or standard output unless specifically 
redirected.  In the first example above, it might be necessary to put 
>/dev/tty0 on some lines in the shell script myfile.  The same holds for the 
commands typed directly to at.

     Files used: /usr/spool/at/YY.DDD.HHMM.UU

# atob
Command:        atob - create a binary file from an archive
Syntax:         (none)
Flags:          (none)
Examples:       (none)

     See the description of 'btoa'.

# atrun
Command:        atrun - run commands for 'at'
Syntax:         (none)
Flags:          (none)
Examples:       (none)

     The program atrun should be started periodically, for example, every
minute by cron, to run commands prepared by at.  Atrun checks to see if any 
files in /usr/spool/at should now be run, and if so, it runs them and then 
puts them in /usr/spool/at/past.  See the description of 'at'.

     Files used: /usr/spool/at/YY.DDD.HHMM.UU
                 /usr/spool/at/past/YY.DDD.HHMM.UU

# backup
Command:        backup - backup files
Syntax:         backup [option] dir1 dir2
Flags:          -d      at top level, only directories are backed up
                -j      do not copy junk: *.o, *.Z, *.bak, a.out core, etc
                -m      if device full, prompt for new diskette
                -n      do not backup top-level directories
                -s      do not copy *.s files
                -t      preserve creation times
                -v      verbose; list files being backed up
                -z      compress the files on the backup medium
Examples:       backup -mz . /f0        # Backup current directory compressed
                backup /bin /usr/bin    # Backup /bin to /usr/bin

     Backup (recursively) backs up the contents of a given directory and its
subdirectories to another part of the file system.  It has two typical uses.
First, some portion of the file system can be backed up onto 1 or more
diskettes.  When a diskette fills up, the user is prompted for a new one.  The
backups are in the form of mountable file systems.  Second, a directory on RAM
disk can be backed up onto a hard disk.  If the target directory is empty, the
entire source directory is copied there, optionally compressed to save space.
If the target directory is an old backup, only those files changed since the
backup was made are copied.  Backup uses times for this purpose, like make.
Large scale backups can be most effectively run from a shell script. 

     Files used: /usr/bin/compress

# badblocks
Command:        badblocks - put a list of bad blocks in a file
Syntax:         badblocks block_special [Up_to_7_blocks] 
Flags:          (none)
Examples:       badblocks /dev/fd1      # Handle bad blocks on /dev/fd1

     If a device develops bad sectors, it is important to not have them 
allocated to important files.  This program makes it possible to collect up
to seven bad blocks into a file, so they will not be allocated for a "real"
file.  When the program starts up, if it is not given a list of bad blocks
it asks for them.  Then it creates a file whose name is of the form
.Bad_xxxxx, where xxxxx is a pid.  The numbers of bad sectors can be obtained
from the program disk_check.

# banner
Command:        banner - print a banner
Syntax:         banner arg ...
Flags:          (none)
Examples:       banner happy birthday   # Print a banner saying happy birthday

     Banner prints its arguments on standard output using a matrix of 6 x 6 
pixels per character.  The @ sign is used for the pixels.

# basename
Command:        basename - strip off file prefixes and suffixes
Syntax:         basename file [suffix]
Flags:          (none)
Examples: basename /user/ast/file       # Strips path to yield file
          basename /user/file.c .c      # Strips path and .c to yield file

     The initial directory names (if any) are removed yielding the name of the 
file itself.  If a second argument is present, it is interpreted as a suffix  
and is also stripped, if present.  This program is primarily used in shell 
scripts.

# bawk
Command:        bawk - pattern matching language
Syntax:         bawk [-f] rules [file] ...
Flags:          -f      read the rules from the following
Examples:       bawk '{ print $0}' filename     # Print filename to stdout
                bawk -f rules file       # Apply the program rules to file

     Awk is a pattern matching language.  Programs are a sequence of pattern-
action statements.  Input lines are scanned for a matching pattern, and if this
is found the associated action is taken.  Bawk is Brodt's Awk, a near subset
of the original.  The file name - can be used to designate standard input.
The language is described in doc/bawk.doc. 

# btoa
Command:        btoa - binary to ascii conversion
Syntax:         btoa [adhor] [infile] [outfile]
Flags:          -a      decode, rather than encode, the file
                -d      extract repair file from diagnosis file
                -h      display a help menu
                -o      use the obsolete algorithm
                -r      repair a damaged archive file
Examples:       btoa <a.out >a.out.btoa         # Convert a.out to ASCII
                btoa -a <a.out.btoa >a.out      # Reverse the above

     Btoa is a filter that converts a binary file to ascii for transmission
over a telephone line.  If two file names are provided, the first is used for
input and the second for output.  If only one is provided, it is used as the
input file.  The program is functionally similar to uue/uud, but the encoding
is completely different.  The file is expanded about 25 percent in the process.
Files are usually decoded by atob, originally a separate program now included
in btoa.  These two programs are an alternative to uue/uud; both btoa/atob and
uue/uud are widely used, and both have been provided with MINIX.

# cal
Command:        cal - print a calendar
Syntax:         cal [month] year
Flags:          (none)
Examples:       cal 3 1987              # Print March 1987

     Cal prints a calendar for a month or year.  The year can be between 1 and 
9999.  Note that the year 87 is not a synonym for 1987, but is itself a valid 
year about 19 centuries ago.  The calendar produced is the one used by England 
and her colonies.  Try Sep 1752, Feb 1900, and Feb 2000.  If you don't 
understand what is going on, look up "Calendar, Gregorian" in a good 
encyclopedia.

# cat
Command:        cat - concatenate files and write them to standard output 
Syntax:         cat [-u] file ...
Flags:          -u      unbuffered output
Examples: cat file              # Display file on the terminal
          cat file1 file2 | lpr # Concatenate two files and print results

     Cat concatenates its input files and copies the result to standard 
output.  If no input file is named, or - is encountered as a file name, 
standard input is used.  Output is buffered in 512 byte blocks unless the -u 
flag is given.

# cc
Command:        cc - C compiler
Syntax:         cc [option] ...  file ...
Flags:          -D      the flag -Dx=y defines a macro x with value y
                -F      use a file instead of a pipe for preprocessor output
                -I      -Idir searches dir for include files
                -L      disable profiling
                -LIB    produce a library module
                -O      used by gc pass @@@
                -R      complain about all non Kernighan & Ritchie code
                -S      stop after producing an assembly code file
                -T      -Tdir tells cem to use dir for temporary files
                -U      undefine a macro
                -c      compile only, do not link (same as -S)
                -i      use separate I & D space (64K + 64K)
                -o      put output on file named by next arg
                -p      use mrtso.s as header
                -v      verbose mode - print pass names
                -w      suppress warning messages
Examples:       cc -c file.c            # Compile file.c
                cc -Di8088 file.c       # Treat the symbol i8088 as defined
                cc -c -LIB file.c       # Make a module for the library
                cc -R -o out file.c     # Check for K & R; output to out

     This is the C compiler.  It has five passes, as follows:
        Program         Input   Output  Operation performed
        /lib/cpp
        /lib/cem        prog.i  prog.k  Parsing and semantic analysis
        /usr/lib/opt    prog.k  prog.m  Optimization of the intermediate code 
        /usr/lib/cg     prog.m  prog.s  Code generation
        /usr/lib/asld   prog.s  a.out   Assembly and linking

     The main program, cc, forks appropriately to call the passes, 
transmitting flags and arguments.  The -v flag causes the passes to be listed 
as they are called.
     The -c or -S flags stop compilation when cg has produced an assembly code 
file (in packed format) because the current assembler-loader expects that.
The libraries are also archives of packed assembly code files, except that
defined symbols must be declared by .define statements at the beginning.  To
make modules for inclusion in the library, use the -c and -LIB options.  There
is no way to get .o files; the packed assembly language files are used as a
substitute.  They can be unpacked with the filter libupack.  Type .x files are
assembler files that require to be run through the C-preprocessor.
     The -R flag gives warnings about all constructions not permitted by 
official Kernighan and Ritchie C.  The average garden-variety C program that 
has been flawlessly acceptedly by most C compilers contains surprisingly many 
illegal constructions.  Try it.
     The compiler normally keeps cpp and cem in memory at the same time, 
transferring the output of cpp to cem using a pipe.  However, if there is 
insufficient memory available to hold both at once, the -F flag can be given 
to cause these two passes to be run strictly sequentially, with the 
preprocessor output being stored on a file in /tmp (unless -T is used).  When 
available memory is very limited (e.g., a 512K machine), it may be necessary 
to run chmem to reduce the sizes of the compiler passes that do not fit,
typically cem.
     The other passes, especially asld, can create large temporary files in 
/tmp.  To compile very large programs, first type
        cc -c *.c
to get .s files.  Then remove /lib/cpp and /lib/cem and possibly other files
from the RAM disk to make more space for /tmp.  Finally, type
        cc *.s
which results in
        asld /usr/lib/crtso.s *.s /usr/lib/libc.a /usr/lib/end.s
to produce the a.out file.  The files removed from the RAM disk can be 
restored by mounting the root file system and copying them from there, or the 
system can be shut down and rebooted.
     If the compiler (or, in fact, almost any program) begins acting strange, 
it is almost always due to its running out of space, either stack space or 
scratch file space.  The relevant pass can be given more stack space using 
chmem.  More space for scratch files can be obtained by removing other files 
on the device.
     The compiler is derived from the ACK system (Tanenbaum et al., 1983), not 
from the AT&T portable C compiler.  It has been shoehorned onto the PC with 
some loss of performance.

     This compiler is used in the Intel versions of Minix only.

# cdiff
Command:        cdiff - produce a context diff
Syntax:         cdiff [-c#] old new
Flags:          -c#     provide # lines of context (default 3)
Examples:       cdiff old new >f        # Write context diff on f

     Cdiff produces a context diff by first running 'diff' and then adding 
context.  Some update programs, like patch, can use context diffs to update 
files, even in the presence of other, independent changes. 

# cgrep
Command:        cgrep - grep and display context
Syntax:         cgrep [-a #] [-b #] [-l #] [-w #] [-f] [-n] pattern [file] ...
Flags:          -a      display # lines after the matching line (default 0)
                -b      display # lines before the matching line (default 0)
                -f      suppress file name in the output
                -l      truncate lines to # columns before match (default 100)
                -n      suppress line numbers in the output
                -w      set window size to # (same as -a n -b n)
Examples:       cgrep -w 3 hello file1  # Print 3 lines of context each way

     Cgrep is a program like grep, except that it also can print a few lines 
above and/or below the matching lines.  It also prints the line numbers of the 
output.

# chgrp
Command:        chgrp - change group
Syntax:         chgrp group file ...
Flags:          (none)
Examples:       chgrp sys file1 file2   # Make sys the group of the files

     The group field of the named files is changed to group.  Alternatively, a 
decimal gid may be specified instead of a user name.  Only the super-user may 
execute this command.  This is the same program as chown.

# chip
Command:        chip - identify a chip
Syntax:         chip [chip_name]
Flags:          (none)
Example:        chip                # print chip type
                chip intel          # return true if chip is 80x6 series

     When executed without arguments, chip returns the chip name as found in
minix/config.h.  If an argument is given, chip returns 0 if it matches
(case-insensitively) the current chip name and 1 if it does not.  If the
program is called as 'machine', the same processes are carried out for
for machine names.  Machine and chip names are:

    Machines:  Ibm_pc            Chips:  Intel
               Sun_4                     M68000 
               Atari                     Sparc
               Amiga
               Macintosh

# chmem 
Command:        chmem - change memory allocation
Syntax:         chmem [+-=] decimal_number file ...
Flags:          (none)
Examples:       chmem =50000 a.out      # Give a.out 50K of stack space
                chmem -4000  a.out      # Reduce the stack space by 4000 bytes
                chmem +1000 file1 file2 # Increase each stack by 1000 bytes

     When a program is loaded into memory, it is allocated enough memory for 
the text and data+bss segments, plus an area for the stack.  Data segment 
hgrowth using malloc, brk, or sbrk eats up stack space from the low end.  The 
amount of stack space to allocate is derived from a field in the executable 
program's file header.  If the combined stack and data segment growth exceeds 
the stack space allocated, the program will be terminated.
     It is therefore important to set the amount of stack space carefully.  If 
too little is provided, the program may crash.  If too much is provided, 
memory will be wasted, and fewer programs will be able to fit in memory and 
run simultaneously.  MINIX does not swap, so that when memory is full, 
subsequent attempts to fork will fail.  The compiler sets the stack space to 
a maximum value; for the 8088, this is 64K - text - data.  For many programs,
this value is far too large.  Nonrecursive programs that do not call brk,
sbrk, or malloc, and do not have any local arrays usually do not need more
than 1K of stack space.
     The chmem command changes the value of the header field that determines 
the stack allocation, and thus indirectly the total memory required to run the 
program.  The = option sets the stack size to a specific value; the + and - 
options increment and decrement the current value by the indicated amount.  
The old and new stack sizes are printed.

# chmod 
Command:        chmod - change access mode for files
Syntax:         chmod octal_number file ...
                chmod [ugoa][+-=][rwxst] file ...
Flags:          (none)
Examples: chmod 755 file            # Owner: rwx Group: r-x Others: r-x
          chmod +x file1 file2      # Make file1 and file2 executable
          chmod a-w file            # Make file read only
          chmod u+s file            # Turn on SETUID for file
          chmod g=u                 # group perms set to same as user perms.

     The given mode is applied to each file in the file list.  The mode can be 
either absolute or symbolic.  Absolute modes are given as an octal number that 
represents the new file mode.  The mode bits are defined as follows:
        4000    Set effective user id on execution to file's owner id
        2000    Set effective group id on execution to file's group id
        0400    File is readable by the owner of the file
        0200    File is writeable by owner
        0100    File is executable by owner
        0070    Same as above, for other users in the same group
        0007    Same as above, for all other users

     Symbolic modes modify the current file mode in a specified way.  They 
take the form:  [who] op permissions { op permissions } The possibilities for 
[who] are 'u', 'g', 'o', and 'a'; standing for user, group, other and all, 
respectively.  If who is omitted, 'a' is assumed, but the current umask is 
used.  The op can be '+', '-', or '='; '+' turns on the given permissions, '-' 
turns them off; '=' sets the permissions exclusively for the given who.  For 
example 'g=x' sets the group permissions to '--x'.
     The possible permissions are 'r', 'w', 'x'; which stand for read, write, 
and execute; 's' turns on the set effective user/group id bits.  'u', other 
permission bits, respectively.  Only one of these may be used at a time.  
Multiple symbolic modes may be specified, separated by commas.

# chown 
Command:        chown - change owner
Syntax:         chown user file ...
Flags:          (none)
Examples:       chown ast file1 file2   # Make ast the owner of the files

     The owner field of the named files is changed to user (ie., login name 
specified).  Alternatively, a decimal uid may be specified instead of a user 
name.  Only the super-user may execute this command.  This is the same program
as chgrp.

# ci
Command:        ci - check in an SVC revision
Syntax:         ci [-lu] file
Flags:          -l      after checking in, check back out again and lock
                -u      after checking in, do not delete the file
Examples:       ci -u Makefile          # Check Makefile back in
                ci -l newfile           # Create SVC file for newfile, relock

     Ci checks the specified file into its SVC archive. If an SVC archive file
did not exist, one is created with the name "file,S". (If a directory named
"SVC" is present in the same directory as "file", the archive will be placed
there instead.) 
     A log message will be prompted for, and read from standard input; this
may be several lines, terminated with "." on a line by itself or EOT. After
the file has been checked in, the default action is to remove the source
file. If "-u" is specified, the file will not be unlinked, but all write
permissions will be removed. If "-l" is specified, a lock is placed on
the SVC archive, and the file will remain writable by the owner. SVC archive
files are always read-only.
    Version numbers start at "1" and are incremented by one for each revision
checked in.
    See also the descriptions of co, svc, svclog.

# clr
Command:        clr - clear the screen
Syntax:         clr
Flags:          (none)
Examples:       clr                     # Clear the screen

     The screen is cleared to blanks.  This program uses the termcap file.

# cmp
Command:        cmp - compare two files
Syntax:         cmp [-ls] file1 file2
Flags:          -l      print (in octal) bytes that differ (loud mode)
                -s      print nothing, just return exit status (silent mode)
Examples: cmp file1 file2       # Tell whether the files are the same 
          cmp -l file1 file2    # Print all corresponding bytes that differ

     Two files are compared.  If they are identical, exit status 0 is 
returned.  If they differ, exit status 1 is returned.  If the files cannot be 
opened, exit status 2 is returned.  If file1 is - , standard input is compared 
to file2.

# co
Command:        co - check out an SVC revision
Syntax:         co [-l] [-r #] file
Flags:          -l      place a lock on the SVC archive after checkout
                -r #    check out revision # instead most recent revision
Examples:       co -l Makefile          # Check out and lock Makefile
                co -r 4 foo             # Check out version 4 of foo

     Co checks the specified file out of its SVC archive.  If the archive
".../file,S" does not exist, it is searched for in ".../SVC/file,S".
     The specified revision will be checked out and placed in "file"; by
default it will be non-writable.  If "-l" is specified, a lock will be
placed on the archive and the file will be writable.
     See also the descriptions of ci, svc, svclog.

# comm
Command:        comm - print lines common to two sorted files
Syntax:         comm [-123] file1 file2
Flags:          -1      suppress column 1 (lines only in file1)
                -2      suppress column 2 (lines only in file2)
                -3      suppress column 3 (lines in both files)
Examples:       comm file1 file2        # Print all three columns
                comm -12 file1 file2    # Print only lines common to both files

     Two sorted files are read and compared.  A three column listing is 
produced.  Files only in file1 are in column 1; files only in file2 are in 
column 2; files common to both files are in column 3.  The file name - means 
standard input.

# compress
Command:        compress - compress a file using modified Lempel-Ziv coding
Syntax:         compress [flags] [-b #] [file] ...
Flags:          -C      generate output compatible with compress 2.0
                -V      give version number and compression statistics 
                -b #    limit the maximum number of bits/code to #
                -c      put output on standard output instead of on file.Z
                -d      decompress instead of compress
                -f      force compressed output even if there is space saved
                -q      quiet mode
                -n      ignore header information (to decompress old files)
                -v      give compression statistics
Examples:       compress <infile >outfile       # Compress 1 file
                compress x y z  # Compress 3 files to x.Z, y.Z, and z.Z

     The listed files (or standard input, if none are given) are compressed
using the Ziv-Lempel algorithm.  If the output is smaller than the input,
the output is put on file.Z or standard output if no files are listed.  If
compress is linked to 'uncompress', the latter is the same as "compress -d".
Similarly, a link to 'zcat' decompresses to standard output by default.

# cp
Command:        cp - file copy
Syntax:         cp file1 file2
                cp file ...  directory
Flags:          (none)
Examples:       cp oldfile newfile      # Copy oldfile to newfile
                cp file1 file2 /usr/ast # Copy two files to a directory

     Cp copies one file to another, or copies one or more files to a 
directory.  A file cannot be copied to itself.

# cpdir
Command:        cpdir - copy a directory and its subdirectories
Syntax:         cpdir [-msv] srcdir destdir
Flags:          -m      merge - copy into an existing directory
                -s      similar - preserves the full mode, uid, gid and times
                -v      verbose - cpdir says what it is doing
Examples:       cpdir dir1 dir2 # creat dir2 and copy dir1's files into it

     Cpdir creates the target directory, goes into it, and copies all the 
files in the source directory to it.  When it is done, the target directory
contains the same files as the source directory.  Subdirectories are copied
recursively.  Links and special files are ignored.

# crc
Command:        crc - print the checksum of a file
Syntax:         crc
Flags:          (none)
Examples:       crc *.c                 # print checksums of all C programs

     The checksum of each argument is computed and printed, along with the 
file length and its name, one file per line.  This program is useful for
seeing if a file transmitted to another machine has arrived correctly.  It is 
conceptually similar to sum, except that it uses a strong checksum algorithm 
and also prints the length.  The filename '-' may be used for standard input.

# cron
Command:        cron - clock daemon
Syntax:         cron
Flags:          (none)
Examples:       /usr/bin/cron           # Use absolute path in /etc/rc

     Cron is a clock daemon.  It is typically started up by including the 
command /usr/bin/cron in the /etc/rc file.  Once started, cron puts itself in 
the background, so no & is needed.  It runs forever, sleeping most of the 
time.  Once a minute it wakes up and examines /usr/lib/crontab to see if there 
is any work to do.  If there is, the work is done.  The entries of 
/usr/lib/crontab contain 6 elements each; minute, hour, day-of-month, month,
day-of-week, command.  Some examples follow:

   min hr dat mo day   command
    *  *   *  *   *    /usr/bin/date >/dev/tty0   # Print date every minute
    0  *   *  *   *    /usr/bin/date >/dev/tty0   # Print date on the hour
   30  4   *  *  1-5   /bin/backup /dev/fd1       # Do backup Mon-Fri at 0430
   30 19   *  *  1,3,5 /etc/backup /dev/fd1       # Mon, Wed, Fri at 1930
    0  9  25 12   *    /usr/bin/sing >/dev/tty0   # Xmas morning at 0900 only

     Comments are allowed in crontab, and cron logs its actions to
/usr/adm/cronlog if this file exists.

     Files used: /usr/lib/crontab
                 /usr/adm/cronlog
 
# cut
Command:        cut - select out columns of a file
Syntax:         cut [-i] [-carg] [-darg] [-farg]
Flags:          -c      select by columns
                -d      change the column delimiter to c
                -f      select by fields
                -i      runs of delimiters count as one
Examples:  cut -f2 file                 # Extract field 2
           cut -c1-2,5 file             # Extract character columns 1, 2, and 5
           cut -c1-5,7- file            # Extract all columns except 6

     Cut extracts one or more fields or columns from a file and writes them on
standard output.  If the -f flag is used, the fields are separated by a
delimiter character, normally a tab, but which can be changed using the -d
flag. If the -c flag is used, specific columns can be selected. The -f and
c flags are mutually exclusive.

# date
Command:        date - print or set the date and time
Syntax:         date [[MMDDYY]hhmm[ss]]
Flags:          -q      read the date from standard input
Examples:       date                    # Print the date and time
                date 0221881610         # Set date to Feb 21, 1988 at 4:10 pm
                date `readclock`        # Set the date from the system RTC 

     Without an argument, date prints the current date and time.  With an 
argument, it sets the date and time.  MMDDYY refers to the month, day, and
year; hhmmss refers to the hour, minute and second.  Each of the six fields 
must be two digits.

# dd
Command:        dd - disk dumper
Syntax:         dd [option = value] ...
Flags:          (none)
Examples:       dd if=/dev/fd0 of=/dev/fd1      # Copy disk 0 to disk 1
                dd if=x of=y bs=1w skip=4       # Copy x to y skipping 4 words
                dd if=x of=y count=3            # Copy 3 512-byte blocks

     This command is intended for copying partial files.  The block size,
skip count, and number of blocks to copy can be specified.  The options are:
        if = file       input file (default is standard input)
        of = file       output file (default is standard output)
        ibs = #         input block size (default 512 bytes)
        obs = #         output block size (default 512 bytes)
        bs = #          block size; sets ibs and obs (default 512 bytes)
        skip = #        skip # input blocks before reading
        seek = #        skip # output blocks before writing
        count = #       copy only # input blocks
        files = #       copy only # files from input
        length =        precede the output with the string 'A.S.Tanenbaum'
        conv = lcase    convert upper case letters to lower case
        conv = ucase    convert lower case letters to upper case
        conv = sync     pad every input record to ibs
        conv = swab     swap every pair of bytes
        conv = noerror  ignore errors and just keep going

     Where sizes are expected, they are in bytes.  However, the letters w, b, 
k, or x may be appended to the number to indicate words (2 bytes), blocks (512 
bytes), or K (1024 bytes), respectively.  When dd is finished, it reports the 
number of full and partial blocks read and written.  Multiple conversion
operations can be separated by commas.

# de
Command:        de - disk editor
Syntax:         de [-w] block_device
                de -r file
Flags:          -r      recover a file that has been removed
                -w      enable writing, so device can be modified
Examples:       de -r /usr/ast/prog.c   # Undo the command rm /usr/ast/prog.c
                de -w /dev/fd0          # Edit /dev/fd0 for writing

     De is a program for system administrators that allows disks to be
inspected block by block.  A variety of display options and commands are
available; for a summary, start the program and type h for help.  The program
can also restore files that have just been removed by rm, provided that the
i-node and blocks are still intact.  Another feature is searching disks for
ASCII strings, to help locate files after a crash.  Finally, individual disk
words can be changed, for example, the sizes of block special files.  The
program is described in doc/de.doc.
    See also the description of recover.
 
# df
Command:        df - report on free disk space and i-nodes
Syntax:         df special ...
Flags:          (none)
Examples:       df /dev/ram             # Report on free RAM disk space
                df /dev/fd0 /dev/fd1    # Report on floppy disk space

     The number of disk blocks and number of i-nodes, both free and used is
reported.  If no argument is given, a report is given on all devices listed
in /etc/mtab.

     Files used: /etc/mtab

# dhrystone
Command:        dhrystone - integer benchmark
Syntax:         dhrystone
Flags:          (none)
Example:        dhrystone               # Run the dhrystone benchmark

     Many years ago, a floating-point benchmark called whetstone was popular
for benchmarking FORTRAN programs.  Nowadays, an integer benchmark called
dhrystone is widely used for benchmarking UNIX systems.  This is it.  Be
warned, however, that dhrystone is entirely CPU bound, and goes blindingly
fast on machines with high-speed caches.  Although this is a good measure for
programs that spend most of their time in some inner loop, it is a poor
benchmark for I/O bound applications.

# diff
Command:        diff - print differences between two files
Syntax:         diff file1 file2
Flags:          (none)
Example:        diff file1 file2        # Print differences between two files

     A simplified version of the V7 utility, diff compares two files and
generates a list of lines telling how the two files differ.  Lines may not be
longer than 128 characters.  The filename '-' may be used for stdin.

# dis88
Command:        dis88 - disassembler
Syntax:         dis88 [-o] infile [outfile]
Flags:          -o      list the object code along with the assembly code
Examples:       dis88 a.out >listing    # Disassemble a.out
                dis88 -o a.out listing  # Ditto, but with object code

     Dis88 is a disassembler.  It takes an executable file and prints the 
symbolic assembly code that corresponds to it, in a form compatible with the
PC/IX assembler.  If the executable file contains a symbol table (added by
the program ast), the symbol table information is used to give a more readable
assembly listing.  The program is described in doc/dis88.doc.

# diskcheck
Command:        diskcheck - check a disk for bad sectors
Syntax:         diskcheck device start_block block_count
Flags:          (none)
Examples:       diskcheck /dev/at0 0 1200       # Check 1.2 MB floppy
                diskcheck /dev/at0 100 1100     # Check floppy from block 100

     Diskcheck checks a disk for bad sectors by reading in each sector, 
writing a known bit pattern onto it, reading it back in and comparing with 
what was written.  This check is then done a second time.  Bad sectors are 
reported.  After each sector is tested, the original sector is restored.

# dosdir
Command:        dosdir - list an MS-DOS diskette directory
Syntax:         dosdir [-lr] drive [path]
Flags:          -l       long listing
                -r       recursively descend and print subdirectories
Example:        dosdir -l C tmp         # Show files in MSDOS directory C:\TMP

     Dosdir reads standard IBM PC diskettes or hard disk partitions in MS-DOS 
format, and lists their contents on standard output.  Directory names should 
contain slashes to separate components, even though MS-DOS uses backslashes.  
The names dosdir, dosread, and doswrite are all links to the same program.  
The program sees which function to perform by seeing how it was called.  The 
program uses device files named dosX, where X is A, B, C, etc. which must be
linked to the appropriate standard device file.

     This is used in the Intel versions of Minix only.

# dosread
Command:        dosread - read a file from an MS-DOS diskette
Syntax:         dosread drive [path/]file
Flags:          -a      ASCII file
Examples:       dosread B g/adv >adv    # Copy MSDOS file B:\G\ADV to ./adv
                dosread A -a prog.c >x  # Copy ASCII file A:\PROG.C to ./x  

     Dosread reads one file from an MS-DOS diskette and writes it on standard 
output.  The file name should use slash, not backslash as a separator.  ASCII 
files have the final CTRL-Z stripped, and carriage return plus line feed are 
mapped to line feed only, the usual MINIX convention.

     This is used in the Intel versions of Minix only.

# doswrite
Command:        doswrite - write a file onto an MS-DOS diskette
Syntax:         doswrite [-a] drive [path/]file
Flags:          -a      ASCII file
Examples:       doswrite B x/y <z       # Copy file ./z to MSDOS file B:\X\Y
                doswrite A -a f         # Copy standard input to file A:\F

     Doswrite writes its standard input to an MS-DOS diskette.  The diskette 
must be formatted and have an MS-DOS file system already in place, including 
all the directories leading up to the file.

     This is used in the Intel versions of Minix only.

# du
Command:        du - print disk usage
Syntax:         du [-as] [-l #] dir
Flags:          -a      give usage for all files 
                -l #    give usage for only # levels of subdirectories
                -s      do not print usage for individual subdirectories
Example:        du dir                  # List disk space used by files in dir

     Du examines a directory and prints the amount of space occupied by the 
files in that directory and its subdirectories.

# echo
Command:        echo - print the arguments
Syntax:         echo [-n] argument ...  
Flags:          -n       no line feed is output when done
Examples:       echo Start Phase 1      # "Start Phase 1" is printed
                echo -n Hello           # "Hello"

     Echo writes its arguments to standard output.  They are separated by 
blanks and terminated with a line feed unless -n is present.  This command is 
used mostly in shell scripts.

# ed
Command:        ed - editor
Syntax:         ed file
Flags:          (none)
Example:        ed prog.c               # Edit prog.c

    Ed is functionally equivalent to the standard V7 editor, ed.  It supports
the following commands:

       (.)     a: append
       (.,.)   c: change
       (.,.)   d: delete
               e: edit new file
               f: print name of edited file
       (1,$)   g: global command
       (.)     i: insert
       (.,.+1) j: join lines together
       (.)     k: mark
       (.)     l: print with special characters in octal
       (.,.)   m: move
       (.,.)   p: print
               q: quit editor
       (.)     r: read in new file
       (.,.)   s: substitute
       (1,$)   v: like g, except select lines that do not match
       (1,$)   w: write out edited file

     Many of the commands can take one or two addresses, as indicated above.  
The defaults are shown in parentheses.  Thus 'a' appends to the current line, 
and 'g' works on the whole file as default.  The dot refers to the current 
line.  Below is a sample editing session with comments given following the # 
symbol.
       ed prog.c                # edit prog.c
       3,20p                    # print lines 3 through 20
       /whole/                  # find next occurence of 'whole'
       s/whole/while/           # replace 'whole' by 'while'
       g/Buf/s//BUF/g           # replace 'MAXBUF' by 'MAX_BUF' everywhere
       w                        # write the file back
       q                        # exit the editor

# elle
Command:        elle - ELLE Looks Like Emacs
Syntax:         elle file [file2] ...
Flags:          (none)
Examples:       elle file.c     # Start the editor

     Elle is a screen-oriented editor that is patterned after Emacs.  It can 
edit multiple files regardless of their length, can support 1 or 2 windows, and
has many other powerful features.  A user-profile .ellepro.b1 can be placed in
$HOME to give elle much the same key-bindings as mined.  There is also a help
file, elle.help, in /usr/lib.  The program is described in doc/elle.doc.

     Files used: .ellpro.b1
                 /usr/lib/elle.help

# expand
Command:        expand - convert tabs to spaces
Syntax:         expand [-tab1,tab2,...] [file,...]
Flags:          -#,#, ...       tab stop positions
Example:        expand -10,20,30,40     # Expand standard input with these tabs

     Expand replaces tabs in the named files with the equivalent numbers of
spaces.  If no files are listed, standard input is given. If only one tab is
given, the rest are multiples of it.  The default is a tab every 8 spaces.

# expr
Command:        expr - evaluate an expression
Syntax:         expr arg ...
Flags:          (none)
Example:        x=`expr $x + 1`         # Add 1 to shell variable x
                expr $PATH : '.*'       # Returns the number of chars in $PATH

     Expr computes the value of its argument and writes the result on standard 
output.  Characters special to the shell must be escaped.  Parentheses are
permitted and numbers may be preceded by a unary minus.  The valid operators
are listed below in order of increasing precedence; those grouped by {...}
have the same precedence.

        expr1 | expr2
            returns expr1 if it is neither null nor 0, otherwise expr2.
        expr1 & expr2
            returns expr1 if neither expr is null or 0, otherwise expr2.
        expr1 {<, <=, =, !=, >=, >} expr2
            returns the result of an integer comparison if both arguments
            are integers, otherwise the result of a text comparison.
        expr1 {+, -} expr2
            returns the sum or difference of integer arguments.
        expr1 {*, /, %}
            returns the product or remainder of integer arguments.
        expr1 : expr2
            returns the number of characters matched on comparing expr1
            with expr2.  Expr2 must be a regular expression of the syntax
            used in ed(1).  All patterns are 'anchored', ie. begin with '^'.
            0 is returned on failure, and the \(...\) pattern symbols can
            be used to return part of expr1.

     Expr returns the following exit values:
        0 if the expression is neither null nor 0
        1 if the expression is null or 0
        2 for invalid expressions  
     
# factor
Command:        factor - factor an integer less than 2**31
Syntax:         factor integer_number
Flags:          (none)
Example:        factor 450180           # Print the prime factors of 450180

     Factor prints the prime factors of its argument in increasing order.  
Each factor is printed as many times as it appears in the number.

# fdisk
Command:        fdisk - partition a hard disk
Syntax:         fdisk [-hno_of_heads] [-sno_of_sectors] [device]
Flags:          (none)
Example:        fdisk                          # use default settings
                fdisk -h4 -s17 /dev/hd0        # actual MINIX defaults

     When fdisk starts up, it reads in the partition table and displays it.  
It then presents a menu to allow the user to modify partitions, store the 
partition table on a file, or load it from a file.  Partitions can be marked 
as DOS or MINIX, and active or not.  The partition type 0x80 should be used
for MINIX before version 1.4b, and 0x81 otherwise.  Where partitions start on
even cylinder boundaries MINIX doesn't care what kind of partition it uses,
except for partition 0. The fact that Minix cannot access the last sector on
an odd-sized partition causes problems when using eg. dosread.  Avoid such
partitions if possible.

    For safety, the device is opened r/o if file permissions do not permit
r/w mode, but be aware that repartitioning a disk may cause information on it
to be lost.  Rebooting the system is mandatory after changing partition sizes.
MINIX, XENIX, PC-IX, MS-DOS and CP/M have different ideas about how partitions
are numbered, and fdisk understands some of them but not all. 

     This is used in the Intel versions of Minix only.

# fgrep
Command:        fgrep - fast grep
Syntax:         fgrep [option] ... [file] [string] [file] ...
Flags:          -c      count matching lines and print only count
                -e      take string from next argument 
                -f      take strings from file named in next argument
                -h      omit file headers from printout
                -l      list file names once only
                -n      each line is preceded by its line number
                -s      status only, no output
                -v      print only lines not matching
Examples:       fgrep # prog.c                  # Print lines containing # sign
                fgrep -f pattern prog.c         # Take strings from 'pattern'

     Fgrep is essentially the same as grep, except that it only searches for 
lines containing literal strings (no wildcard characters), and it is much 
faster.  

# file
Command:        file - make a guess as to a file's type based on its contents
Syntax:         file name ...
Flags:          (none)
Example:        file a.out /usr/include/ar.h    # Guess at types

     File reads the first block of a file and tries to make an intelligent 
guess about what kind of file it is.  It understands about directories,
block and character special files, archives, object files, executable
binaries, shell scripts, C programs, English text, and ASCII text.  Any file
it can't recognise it calls 'data'.

# find
Command:        find - find files meeting a given condition
Syntax:         find directory expression
Flags:          (none)
Examples:       find /  -name a.out -print      # Print all a.out paths
                find /usr/ast ! -newer f -ok rm {} \;   # Ask before removing
                find /usr -size +20 -exec mv {} /big \; # Move files > 20 blks
                find / \( -name a.out -o -name `*.o` \) -exec rm {}\; # two
                                                                # conditions

     Find descends the file tree starting at the given directory checking each 
file in that directory and its subdirectories against a predicate.  If the 
predicate is true, an action is taken.  The predicates may be connected by -a 
(Boolean and), -o (Boolean or) and ! (Boolean negation).  Each predicate is 
true under the conditions specified below.  The integer n may also be +n to 
mean any value greater than n, -n to mean any value less than n, or just n for 
exactly n.
  -name s       true if current filename is s (include shell wild cards)
  -perm n       true if the file's permission bits = n (n is in octal)
  -type x       where x is bcdfug (block, char, dir, regular, setuid, setgid)
  -links n      true if the number of links to the file is n
  -user u       true if the uid = u (a numerical value, not a login name)
  -group g      true if the gid = g (a numerical value, not a group name)
  -size n       true if file size is n blocks
  -inum n       true if the current file's i-node number is n
  -atime n      true if access time... not implemented under MINIX
  -mtime n      true if modification time relative to today (in days) is n
  -newer f      true if the file is newer than f
  -xdev         do not cross devices to search mounted file systems.
The expression can be followed by one of the actions listed below, to say what
must be done when a file is found:
  -print        print the file name on standard output
  -exec         execute a MINIX command, {} stands for the file name
  -ok           prompts before executing the command

# fix
Command:        fix - update a file from a difflist
Syntax:         fix oldfile difflist >newfile
Flags:          (none)
Example:        fix old difflist >new   # Generate new from old and diffs

     Fix accepts a diff listing produced by diff and reconstructs the new 
file.  It is common for people to take a file, modify it, and then send the 
diff listing between the old and new files to other people.  Using fix, the  
old file, and the diff listing, it is possible to create the new file.  For 
example:
        diff oldfile newfile >difflist
        fix oldfile difflist >new2

will generate a file new2 that is identical to newfile.  A more sophisticated
alternative to fix is patch.

# fold
Command:        fold - fold long lines
Syntax:         fold [-#] [file] ...
Flags:          -#       set output line length to # columns (default 80)
Examples:       fold -60                # Fold standard input to 60 characters
                fold file               # Fold file to 80 character lines

     Fold takes copies its input from the named file (or standard input, if
none is specified) to standard output.  However, lines longer than the given
maximum length are broken into multiple lines of the maximum length by
inserting newline characters.

# fortune
Command:        fortune - print a fortune
Syntax:         fortune 
Flags:          (none)
Examples:       fortune                 # Print a fortune

     Fortune picks a fortune at random from the fortune database file, and
prints it.  This file consists of text separated by a line containing only %%.

     Files used: /usr/lib/fortune.dat

# from
Command:        from - input half of a connection
Syntax:         from port
Flags:          (none)
Examples:       from port | sort >x     # Fetch and sort an incoming file
                from port | sh          # Primitive sherver

     To and from are used together to provide connection-oriented service.  On 
the sending machine, the last member of a pipeline is 'to port'.  On the 
receiving machine, the first member of a pipe line is 'from port'.  The net 
result is that the output of the sending pipeline goes into the input of the 
receiving pipeline, making pipelines work across the network.

# fsck
Command:        fsck - perform file system consistency check
Syntax:         fsck [-options] [device] ...
Flags:          -a      automatically repair inconsistencies
                -c      check and list only the specified inodes
                -i      check the file system, reporting the inodes specified
                -l      list the files and directories in the filesytem
                -r      prompt user for repairs if inconsistencies are found
                -s      list the superblock of the file system
                -z      check the file system, reporting the zones specified
Examples:       fsck /dev/hd4           # Check file system on /dev/hd4
                fsck -a /dev/at0        # Automatically fix errors on /dev/at0
                fsck -l /dev/fd0        # List the contents of /dev/fd0
                fsck -c 2 3 /dev/hd3    # Check and list /dev/hd3 inodes 2 & 3

     Fsck performs consistency checks on the file systems which reside on the 
specified devices.  It may also be used to list the contents of a file system 
or repair a damaged file system.  In MINIX versions earlier than 1.5, fsck
can be run from the startup menu. 

# gather
Command:        gather - gather up the files in a directory for transmission
Syntax:         gather [-s source_dir] [-d dest_dir] [-b max_size] [-f file]
Flags:          -b      desired number of bytes per output file (default 60Kb)
                -d      destination directory for the archives (default ./)
                -f      base name for the archives
                -s      source directory for the files (default ./)
Examples:  gather                       # Put files in ./ into 60K archives
           gather -d dir                # Put the archives in dir
           gather -b 90000              # Try to produce 90K archives

     It is often useful to collect all the files in a directory into one or
more archives for transmission by mail.  This program collects all the files
in the source directory and puts them into a shar archive.  The shar archive
is then compressed and uuencoded.  An attempt is made to have the final .uue
file be about the given size, but since gather cannot really predict how much
shar will add to the file, how much compress will reduce the file, and how
much uue will add again, the final sizes can fluctuate.  If the -f file flag
is given, the archives will be given the names file_00.uue, file_01.uue etc.
If -f is not given, the name of the source directory is used as the base name.

# getlf
Command:        getlf - wait until a line has been typed
Syntax:         getlf [argument]
Flags:          (none)
Examples:       getlf                   # Wait for a line

     In shell scripts it is sometimes necessary to pause to give the user a  
chance to perform some action, such as inserting a diskette.  This command 
prints its argument, if any, and then waits until a carriage return has been 
typed, at which time it terminates.  It is used in /etc/rc.

# getty
Command:        getty - get the terminal line parameters for login
Syntax:         getty line [-c file] [-h] [-k] [-t] [speed]
Flags:          -c fn   use file fn as gettydefs file
                -h      do not hang up phone after reset
                -k      do not use speed selection
                -t      do not time-out at login prompt
Examples:       getty /dev/tty1 1200            # Connect to tty1
                getty /dev/tty1 console         # Connect to console

     The getty program allows a terminal port to be used for both dialin and
dialout.  It can also detect user speed, and set various line parameters. On
startup, getty searches the gettydefs file for an entry which matches the
given speed parameter, and sets up the terminal line in accordance with the
initial parameters of that gettydef entry.  If no match is found, or getty
is called without a second argument, the first entry in the file is used.
     Once the terminal is set up, getty waits for a carrier detect signal, and
when one is received it prints the contents of the /etc/issue file, usually
the system name.  It then prompts for a login name, and on receipt of this
resets the terminal parameters to the final gettydef entry parameters, and
calls login with the given username as an argument.
     If it is called as uugetty, getty will prepare the line for uucp.  If
/etc/utmp and /usr/adm/wtmp exist, getty will handle user accounting.

     Files used: /etc/gettydefs
                 /etc/issue
                 /etc/utmp
                 /usr/adm/wtmp

# grep
Command:        grep - search a file for lines containing a given pattern
Syntax:         grep [-ln] [-s] [-v] [-e] pattern [file] ...
Flags:          -e      -e pattern is the same as pattern
                -l      prints just file names, no lines (overrides -n)
                -n      print line numbers
                -s      give status only, and no printed output
                -v      select lines that do not match the pattern
Examples:       grep mouse file         # Find lines in file containing mouse
                grep [0-9] file         # Print lines containing a digit 

     Grep searches one or more files (by default, standard input) and selects 
out all the lines that match the pattern.  All the regular expressions
accepted by mined are allowed.  In addition, + can be used instead of * to 
mean 1 or more occurrences, ? can be used to mean 0 or 1 occurrences, and | 
can be used between two regular expressions to mean either one of them;
parentheses can be used for grouping.  Grep returns the following exit status:
       0 when a match is found. 
       1 when no match is found
       2 when an error is detected

Note that when the -l and -v flags are used together, only the names of those
files that do not contain the pattern anywhere are listed.

# gres
Command:        gres - grep and substitute
Syntax:         gres [-g] pattern string [file] ...
Flags:          -g      change only the first occurrence on each line
Examples:       gres bug insect         # Replace bug with insect
                gres "^[A-Z]+$" CAPS    # Replace capitals-only lines with CAPS

     Gres is a poor man's sed.  It looks for the same patterns as grep, and
replaces each one by the given string.

# head
Command:        head - print the first few lines of a file
Syntax:         head [-#] [file] ...
Flags:          -#      print # lines (default 10)
Examples:       head -6                 # Print first 6 lines of standard input
                head -1 file1 file2     # Print first line of two files

     The first few lines of one or more files are printed.  The default input
file is standard input.

# help
Command:        help - give help about a command
Syntax:         help [name]
Flags:          (none)
Example:        help uuencode

     Help gives help about a given command name (or help itself, if none is
specified).  It gets its information from /usr/lib/helpfile, which should be
linked to doc/man_pages.  To improve performance, it builds an index file,
/usr/lib/helpfile.idx; this is automatically updated when it becomes older
than /usr/lib/helpfile.  Lines in the helpfile beginning with # contain the
keywords for help.

     Files used: /usr/lib/helpfile
                 /usr/lib/helpfile.idx

# ic
Command:        ic - integer calculator
Syntax:         ic [expression]
Flags:          (none)
Examples:       ic              # Start the calculator
                ic 250 300+     # Start calculator with 550 on the stack

     Ic is a reverse Polish notation calculator that works on 32-bit integers.
It starts out by computing the expression given as an argument, if any, and
then expects keyboard input.  As an example, to compute `23+5' one first
converts this to reverse Polish, `23 5+'.  After the calculator starts, type
`23' followed by a carriage return.  Then type `5' and another carriage return.
Finally type `+' to see the result, 28 displayed on the stack.  Other
operations work the same way.  The calculator can use other radices for input
and output, and has registers that can be stored and loaded.  The h command
gives the help menu, and the program is described in doc/ic.doc.

# id
Command:        id - print a user's identity
Syntax:         id
Flags:          (none)
Examples:       id                      # Report uid and gid

     Id prints the current user's uid and gid, both numerically and 
symbolically, using the information from /etc/passwd and /etc/group.  If the
effective uid and gid are different from the real ones, all of them are given.

# ifdef
Command:        ifdef - remove unwanted ifdefs from C code
Syntax:         ifdef [-t] [-Dsymb] [-dsymb] [-Usymb] [-Isymb] [file]
Flags:          -t     # display a table of defined and undefined symbols
                -D     # symbol can change from defined <-> undefined)
                -d     # symbol cannot change from defined <-> undefined)
                -U     # undefine the symbol
                -I     # ignore the symbol
Example:        ifdef -t ifdef.c        # show the defines in ifdef.c

     Ifdef strips unwanted #defines from C code, making it easier to read,
understand, and possibly compile.

# indent
Command:        indent - indent and format C program source
Syntax:         indent  [ input-file [ output-file ] ] [option] ...
Flags:          (too many to count)
Examples:       indent foo.c            # Indent foo.c using .indent.pro

     Indent is a C program formatter.  It reformats the C program in the input-
file according to the switches.  It has an enormous number of options which are
listed in the file doc/indent.doc.
     If you only specify an input-file, the formatting is done in-place, that
is, the formatted file is written back into input-file and a backup copy of
input-file is written in the current directory.  If input-file is named
'/blah/blah/file', the backup file is named file.BAK.
     You may set up your own profile of defaults to indent by creating a file
called .indent.pro in either your login directory and/or the current directory
and including whatever switches you like.

# inodes
Command:        inodes - print i-node information
Syntax:         inodes
Flags:          (none)
Examples:       inodes                  # Print information about inodes

     Inodes expects a list of file names on stdin, one file name per line.  
For each file named, the file type, mode, uid, gid, length, checksum, and
name is printed.  The checksum algorithm is the same as that used by crc.

# kermit
Command:        kermit - transfer a file using the kermit protocol
Syntax:         kermit
Flags:          (many)
Example:        kermit                  # Start kermit

     Kermit is a file transfer program, remote connection program, and much
more.  It is widely used for mainframe/micro communications.  Even summarizing
it here would be out of the question.  For a description of it, see the 379
page book 'Kermit: A File Transfer Protocol' by Frank da Cruz, Digital Press,
1987, ISBN 0-932376-88-6, and the file doc/kermit.doc.
     On startup, kermit looks for the file .kermrc in the current or home
directory, and runs any commands that it contains. 

    Files used: .kermrc

# kill 
Command:        kill - send a signal to a process
Syntax:         kill [-signal] process
Flags:          (none)
Examples:       kill 35                 # Send signal 15 to process 35
                kill -9 40              # Send signal 9 (SIGKILL) to process 40
                kill -2 0               # Send signal 2 to whole process group

     A signal is sent to a given process.  By default signal 15 (SIGTERM) is 
sent.  Process 0 means all the processes in the sender's process group.

# last
Command:        last - display the user log-in history
Syntax:         last [-f file] [-r] [-#] [name] [tty] ...
Flags:          -f      use file instead of /usr/adm/wtmp
                -r      search backwards only to last reboot
                -#      print a maximum of n lines

Examples:       last reboot             # When was the system last rebooted?
                last ast                # When was the last login for ast?
                last -10 tty0 tty1      # Display last 10 logins on tty0/tty1

     Last searches backward through the login administration file (default is
/usr/adm/wtmp), printing information about previous logins, logouts, shutdowns
and reboots.  During a long search, the SIGQUIT signal (CTRL-\) causes last to
display how far back it has gone; it then continues.

     Files used: /usr/adm/wtmp

# leave
Command:        leave - warn when it is time to go home
Syntax:         leave [ [+] hh[:]mm]
Flags:          (none)
Examples:       leave 1500              # Issue a warning at 2:55 p.m.
                leave 10:00             # Issue a warning at 9:55 a.m.
                leave + 30              # Issue a warning in 25 minutes.

     Leave sets an alarm clock to a specified time and issues a warning 5 
minutes before, 1 minute before, and at the time to leave.  It then keeps 
issuing warnings every minute for 10 minutes, then quits.  If no time is 
provided, the program prompts for one.  Leave uses the login/logout records
kept in /usr/adm/wtmp if they exist; to switch off the alarm, kill the process.

     Files used: /usr/adm/wtmp

# libpack
Command:        libpack - convert an ASCII assembly code file to packed form
Syntax:         libpack
Flags:          (none)
Examples:       libpack <x.s >y.s       # Pack x.s

     This program is a filter that reads an ASCII assembly code file from 
standard input and writes the corresponding packed file on standard output.  
The compiler libraries are archives of packed assembly code files, in which
common assembly code strings are replaced by single-byte abbreviations.  All
abbreviations have their high bit set.

     This is used in the Intel versions of Minix only.

# libupack
Command:        libupack - convert a packed assembly code file to ASCII
Syntax:         libupack
Flags:          (none)
Examples:       libupack <y.s >x.s      # Unpack y.s

     This program is a filter that reads a packed assembly code file from 
standard input and writes the corresponding ASCII file on standard output.
The compiler libraries are archives of packed assembly code files, in which
common assembly code strings are replaced by single-byte abbreviations.  All
abbreviations have their high bit set.

     This is used in the Intel versions of Minix only.

# lind
Minix 1.5.10 long file index.

[                 test for a condition
animals           twenty questions type guessing game about animals
ar                archiver
ascii             strip all the pure ASCII lines from a file
asld              assembler-loader
ast               add a symbol table to an executable file
at                execute commands at a later time
atob              create a binary file from an archive
atrun             run commands for 'at'
backup            backup files
badblocks         put a list of bad blocks in a file
banner            print a banner
basename          strip off file prefixes and suffixes
bawk              pattern matching language
btoa              binary to ascii conversion
cal               print a calendar
cat               concatenate files and write them to standard output 
cc                C compiler
cdiff             produce a context diff
cgrep             grep and display context
chgrp             change group
chip              identify a chip
chmem             change memory allocation
chmod             change access mode for files
chown             change owner
ci                check in an SVC revision
clr               clear the screen
cmp               compare two files
co                check out an SVC revision
comm              print lines common to two sorted files
compress          compress a file using modified Lempel-Ziv coding
cp                file copy
cpdir             copy a directory and its subdirectories
crc               print the checksum of a file
cron              clock daemon
cut               select out columns of a file
date              print or set the date and time
dd                disk dumper
de                disk editor
df                report on free disk space and i-nodes
dhrystone         integer benchmark
diff              print differences between two files
dis88             disassembler
diskcheck         check a disk for bad sectors
dosdir            list an MS-DOS diskette directory
dosread           read a file from an MS-DOS diskette
doswrite          write a file onto an MS-DOS diskette
du                print disk usage
echo              print the arguments
ed                editor
elle              ELLE Looks Like Emacs
expand            convert tabs to spaces
expr              evaluate an expression
factor            factor an integer less than 2**31
fdisk             partition a hard disk
fgrep             fast grep
file              make a guess as to a file's type based on its contents
find              find files meeting a given condition
fix               update a file from a difflist
fold              fold long lines
fortune           print a fortune
from              input half of a connection
fsck              perform file system consistency check
gather            gather up the files in a directory for transmission
getlf             wait until a line has been typed
getty             get the terminal line parameters for login
grep              search a file for lines containing a given pattern
gres              grep and substitute
head              print the first few lines of a file
help              give help about a command
ic                integer calculator
id                print a user's identity
ifdef             remove unwanted ifdefs from C code
indent            indent and format C program source
inodes            print i-node information
kermit            transfer a file using the kermit protocol
kill              send a signal to a process
last              display the user log
leave             warn when it is time to go home
libpack           convert an ASCII assembly code file to packed form
libupack          convert a packed assembly code file to ASCII
ln                create a link to a file
login             log into the computer
look              look up words in a dictionary
lorder            compute the order for library modules
lpr               copy a file to the line printer
ls                list the contents of a directory 
m4                macro processor
machine           identify a machine
mail              send and receive electronic mail
make              maintain large programs
man               display a manual page
master            control the creation of shervers
mined             MINIX editor
mkdir             make a directory
mkfs              make a file system
mknod             create a special file
mkproto           make a mkfs prototype file
modem             put a modem into dial-in or dial-out mode
more              pager
mount             mount a file system
mref              make a listing and cross-reference map of MINIX
mv                move or rename a file
nm                print a symbol table
nroff             text formatter
od                octal dump
passwd            change a login password
paste             paste multiple files together
patch             update a file from the original and a diff
pr                print a file
prep              prepare a text file for statistical analysis
pretty            MINIX pretty printer
printenv          print out the current environment
printroot         print the root device name on standard output
ps                report the process status
pwd               print the working directory
rcp               remote copy
readall           read a device quickly to check for bad blocks
readclock         read the AT's real time clock
readfs            read a MINIX file system
recover           recover files that have been removed.
rev               reverse the characters on each line of a file
rm                remove a file
rmdir             remove a directory
roff              text formatter
rsh               remote shell for networking
rz                receive a file using the zmodem protocol
sed               stream editor 
sh                shell
shar              shell archiver
sherver           shell server
size              print the text, data, and bss sizes of a program
sleep             suspend execution for a given number of seconds
sort              sort a file of ASCII lines
spell             print the words in a file that are not in a dictionary
split             split a large file into several smaller files
strings           print all the strings in a binary file
strip             remove a symbol table from an executable file
stty              set the terminal parameters
su                temporarily log in as super-user or another user
sum               compute the checksum and block count of a file
svc               shell version control system
svclog            print a log of SVC revisions
sync              flush the cache to disk
sz                send a file using the zmodem protocol
tail              print the last few lines of a file
tar               tape archiver
tee               divert standard input to a file
term              turn an IBM PC into a dumb terminal
termcap           print the current termcap entry
test              test for a condition
time              report how long a command takes
to                output half of a connection
touch             update a file's time of last modification
tr                translate character codes
traverse          print the directory tree under a named directory
treecmp           recursively list differences in two directory trees
true              exit with the value true
tset              set the $TERM variable
tsort             topological sort
ttt               tic tac toe
tty               print the device name of this tty
umount            unmount a mounted file system
uncompress        decompress a file using modified Lempel-Ziv coding
unexpand          convert spaces to tabs
uniq              delete consecutive identical lines in a file
unshar            extract files from a shell archive
update            write the buffer cache to disk regularly 
users             list the logged-in users
uud               decode a binary file encoded with uue
uue               encode a binary file using ASCII
vol               split the standard input into diskette-sized volumes
wc                count characters, words, and lines in a file
whatsnew          print a newly modified file, marking changes
whereis           examine the system directories for a given file
which             examine $PATH to see which file will be executed
who               print a list of currently logged in users
whoami            print the current user name
width             force all the lines of a file to a given width
write             send a message to a logged-in user
zcat              decompress a file using modified Lempel-Ziv coding

# ln
Command:        ln - create a link to a file
Syntax:         ln file [name]
Flags:          (none)
Examples:       ln file newname         # Make newname a synonym for file
                ln /usr/games/chess     # Create a link called chess 

     A directory entry is created for name.  The entry points to file.  
Henceforth, name and file can be used interchangeably.  If name is not 
supplied, the last component of file is used as the link name and the
link is created in the current directory.

# login
Command:        login - log into the computer
Syntax:         login [user]
Flags:          (none)
Examples:       login ast               # Login as ast

     If login is given a username as an argument, it allows a logged in user
to login as someone else without first logging out.  If a password is needed,
login will prompt for it.  Login will time out after 30 seconds, and will
delay after a bad username is entered.  If the file /etc/nologin exists, no
logins will be permitted.  If the file /etc/motd exists, login will print it
on the standard output immediately after a successful login. 

     If /usr/adm/wtmp or /etc/utmp exist login will use them for accounting
purposes, as will init.  (They will also be used by other programs such as
write).  If these files do not exist, neither init nor login will create them.
Note that the files, once created, will grow forever and eventually fill the
disk unless they are manually truncated from time to time.

     Files used: /usr/adm/wtmp
                 /etc/utmp
                 /etc/nologin
                 /etc/motd

# look
Command:        look - look up words in a dictionary
Syntax:         look [-f] prefix[/suffix] [dictionary] 
Flags:          -f      fold upper case letters to lower case
Examples:       look ard                # Print words starting with ard
                look /bing              # Print words ending in bing
                look -f f/ar            # Words starting with f, ending in ar

     Look takes a prefix and/or suffix and searches /usr/lib/dictionary or the 
specified dictionary for all words that match, which it then prints. The -f
flag causes all upper case letters to be treated as lower case.  This program
differs slightly from the UNIX look(1).

     Files used: /usr/lib/dictionary

# lorder
Command:        lorder - compute the order for library modules
Syntax:         lorder file ...
Flags:          (none)
Example:        lorder proc1.s proc2.s  # Give lorder information

     Lorder accepts a series of packed or unpacked .s files and libraries, and
produces a partial ordering suitable for processing by tsort.

     This is used in the Intel versions of Minix only.

# lpr
Command:        lpr - copy a file to the line printer
Syntax:         lpr [file] ...
Flags:          (none)
Examples:       lpr file &              # Print file on the line printer
                pr file | lpr &         # Print standard input (pr's output)

     Each argument is interpreted as a file to be printed.  Lpr copies each 
file to /dev/lp, without spooling.  It inserts carriage returns and expands 
tabs.  Only one lpr at a time may be running.

# ls
Command:        ls - list the contents of a directory 
Syntax:         ls [options] name ...
Flags:          -1      print in one-column format
                -A      print all entries except . and .. (default for su)
                -C      print in columnar format
                -F      print '/' after directory names, '*' after executables
                -R      recursively print each subdirectory
                -a      print all entries including those starting with '.'
                -c      use the file create time... not implemented in MINIX
                -d      print named directories, not their contents
                -f      force interpretation of 'file' as a directory
                -g      print group id with user id in long listing format
                -i      print the inode number with each file
                -l      long listing of mode, links, owner, size and time
                -r      reverse the sort order
                -s      give size in blocks (including indirect blocks)
                -t      sort by the file modification time, latest first
                -u      use the file access time... not implemented in MINIX 
Examples:       ls -l                   # List files in working directory
                ls -lis                 # List with i-nodes and sizes

     For each file argument, list it.  For each directory argument, list its 
contents, unless -d is present.  When no argument is present, the working 
directory is listed.

# m4
Command:        m4 - macro processor
Syntax:         m4 [-D name = value] [-U name]
Flags:          -D name = value         define a symbol
                -U name                 undefine a symbol
Example:        m4 <m4test              # Run M4

     M4 is a general-purpose macro processor, based on the one desribed in
'Software Tools', and extended by most of the SysV M4 command set.  It has
been used to implement programming languages, such as RATFOR.  It is described
in doc/m4.doc.

# machine
Command:        machine - identify a machine
Syntax:         machine [machine_name]
Flags:          (none)
Example:        machine             # print machine type
                machine IBM_PC      # return true if machine is IBM_PC

     When executed without arguments, machine returns the machine name as
found in minix/config.h.  If an argument is given, machine returns 0 if
it matches (case-insensitively) the current machine name and 1 if it does
not.  If the program is called as 'chip', the same processes are carried out
for chip names.  Machine and chip names are:

    Machines:  Ibm_pc            Chips:  Intel
               Sun_4                     M68000 
               Atari                     Sparc
               Amiga
               Macintosh

# mail
Command:        mail - send and receive electronic mail
Syntax:         mail [-dpqrv] [-f file] [user]
Flags:          -d      force use of MAILER 
                -f      use file instead of /usr/spool/mail/user as mailbox
                -p      print all mail and then exit
                -q      quit program if SIGINT received
                -r      reverse print order, ie. print oldest first
                -v      verbose mode
Examples:       mail ast                # Send a message to ast
                mail                    # Read your mail

     Mail is an extremely simple electronic mail program.  It can be used to
send or receive email on a single MINIX system, in which case it functions as
user agent and local delivery agent.  If the MAILER is defined in mail.c, it
can also call a transport agent to handle remote mail as well.
     When called by user with no arguments, it examines the mailbox
/usr/spool/mail/user, prints one message (depending on the -r flag), and waits
for one of the following commands:
        <newline>       go to the next message
        -               print the previous message
        !command        fork off a shell and execute command
        CTRL-D          update the mailbox and quit (same as q)
        d               delete the current message and go to the next one
        q               update the mailbox and quit (same as CTRL-D)
        p               print the current message again
        s[file]         save message in the named file
        x               exit without updating the mailbox

    To send mail, the program is called with the name of the recipient as
argument.  The mail is sent, along with a postmark line containing the date.
For local delivery, a file named after the recipient in the directory
/usr/spool/mail must be writable.

    Files used: /usr/spool/mail/username
                /usr/spool/mail/username.lock
                /usr/lib/mail.help

# make
Command:        make - maintain large programs
Syntax:         make [-f file] [-ikns] [option] ...  [target]
Flags:          -a      try to guess undefined ambiguous macros (*,<)
                -d      print debugging info
                -e      environment macro defs. overwrite makefile defs.
                -f      use file as the makefile
                -i      ignore status returned by commands
                -k      kill branch on error
                -n      report, but do not execute
                -p      print all macros and targets
                -q      question up-to-date target. Return exit=1 if not.
                -r      do not use inbuilt rules
                -s      silent mode
                -t      touch files instead of making them
Examples:       make kernel             # Make kernel up to date
                make -n -f file         # Tell what needs to be done

     Make is a program that is normally used for developing large programs 
consisting of multiple files.  It keeps track of which object files depend on 
which source and header files.  When called, it does the minimum amount of 
recompilation to bring the target file up to date.
     The file dependencies are expected in makefile or Makefile, unless
another file is specified with -f.  Make has some default rules built in, for 
example, it knows how to make .s files from .c files.  Here is a sample 
makefile (tabs are significant):
        d=/user/ast                     # d is a macro
        prog:   head.s tail.s           # 'prog' depends on these
                cc -o program head.s tail.s     # tells how to generate 'prog'
                echo prog done
        head.s: $d/def.h head.c         # head.s depends on these
        tail.s: $d/var.h tail.c         # tail.s depends on these 

A complete description of make would require too much space here.  For more
information, see Feldman (1979).  Many books on UNIX also discuss make, and
the MINIX version is a fairly complete implementation.

# man
Command:        man - display a manual page
Syntax:         man [manual-directory] [#] [name] ...
Flags:          (none)
Examples:       man cdiff               # Display man page for cdiff(1)
                man 2 fork              # Display man page for fork(2)
                man 3                   # List the part 3 man pages

     Man is a program that displays manual pages, which are stored in the
directory /usr/man, one volume per file.  When called with just a program
name, man displays the page for that program, if it can be found in the
default volume (man1).  Man builds an index for each file in the /usr/man
directory, and updates these whenever a man file becomes more recent than
its current index file.
     When the digit # is given as an argument, the volume /usr/man/man# is
used instead of the default volume.  When no name is given (or just a digit),
the list of pages in that volume is displayed.  The cursor keys can be used to
select an entry, and <return> then displays the page selected.  Q or q leaves
the program.  A directory name can be given to override the use of /usr/man.

     Files used: /usr/man/man1, etc.
                 /usr/man/._man1, etc. 
 
# master
Command:        master - control the creation of shervers
Syntax:         master count uid gid command
Flags:          (none)
Example:        master 2 1 1 /usr/bin/sherver port # Start two shervers

     If a machine is intended to be used as a server, its /etc/rc file should 
have a command similar to the example above.  When the system is booted, 
master runs and forks off the required number of shervers (shell servers), up 
to a maximum of four.  They run with the indicated uid and gid, and listen to 
the indicated port.  When an rsh is done on a client machine, the command is 
given to one of the shervers for execution.  When the sherver is done it exits,
and the master, which is always running, sees this and creates a new sherver.  
Thus master is very similar to init, only it makes new shervers (usually) 
instead of new login programs.  Master must run as root to be able to do  
setuid and setgid.  

# mined
Command:        mined - MINIX editor
Syntax:         mined [file]
Flags:          (none)
Examples:       mined /usr/ast/book.3   # Edit an existing file
                mined                   # Call editor to create a new file
                ls -l | mined   # Use mined as a pager to inspect listing

     Mined (pronounced min-ed) is a simple full-screen editor.  When editing a 
file, it holds the file in memory, thus speeding up editing, but limiting the 
editor to files of up to about 43K.  Larger files must first be cut into 
pieces by split.  Lines may be arbitrarily long.  Output from a command may be 
piped into mined so it can be viewed without scrolling off the screen.
     At any instant, a window of 24 lines is visible on the screen.  The 
current position in the file is shown by the cursor.  Ordinary characters 
typed in are inserted at the cursor.  Control characters and keys on the 
numeric keypad (at the right-hand side of the keyboard) are used to move the 
cursor and perform other functions.
     Commands exist to move forward and backward a word, and delete words.  A 
word in this context is a sequence of characters delimited on both ends by 
white space (space, tab, line feed, start of file, or end of file).  The 
commands for deleting characters and words also work on line feeds, making it 
possible to join two consecutive lines by deleting the line feed between them.
     The editor maintains one save buffer (not displayed).  Commands are 
present to move text from the file to the buffer, from the buffer to the file, 
and to write the buffer onto a new file.  If the edited text cannot be written 
out due to a full disk, it may still be possible to copy the whole text to the 
save buffer and then write it to a different file on a different disk with 
CTRL-Q.  It may also be possible to escape from the editor with CTRL-S and 
remove some files.
     Some of the commands prompt for arguments (file names, search patterns, 
etc.).  All commands that might result in loss of the file being edited prompt 
to ask for confirmation. 
     A key (command or ordinary character) can be repeated n times by typing 
ESC n key where ESC is the 'escape' key.
     Forward and backward searching requires a regular expression as the 
search pattern.  Regular expressions follow the same rules as in the UNIX 
editor, ed:
        1.  Any displayable character matches itself.
        2.  . (period) matches any character except line feed.
        3.  ^ (circumflex) matches the start of the line.
        4.  $ (dollar sign) matches the end of the line.
        5.  \c matches the character c (including period, circumflex, etc).
        6.  [string] matches any of the characters in the string.
        7.  [^string] matches any of the characters except those in the string.
        8.  [x-y] matches any characters between x and y (e.g., [a-z]).
        9.  Pattern* matches any number of occurrences of pattern.

Some examples of regular expressions are:
        The boy  matches the string 'The boy'
        ^$       matches any empty line.
        ^A.*\.$  matches any line starting with an A, ending with a period.
        ^[A-Z]*$ matches any line containing only capital letters (or empty).
        [A-Z0-9] matches any line containing a capital letter or a digit.

     Control characters cannot be entered into a file simply by typing them  
because all of them are editor commands.  To enter a control character, 
depress the ALT key, and then while holding it down, hit the ESC key.  Release 
both ALT and ESC and type the control character.  Control characters are 
displayed in reverse video.
     The mined commands are as follows.
CURSOR MOTION
        arrows  Move the cursor in the indicated direction
        CTRL-A  Move cursor to start of current line
        CTRL-Z  Move cursor to end of current line
        CTRL-^  Move cursor to top of screen
        CTRL-_  Move cursor to end of screen
        CTRL-F  Move cursor forward to start of next word
        CTRL-B  Move cursor backward to start of previous word
SCREEN MOTION
        Home key        Move to first character of the file
        End key         Move to last character of the file
        PgUp key        Scroll window up 23 lines (closer to start of the file)
        PgDn key        Scroll window down 23 lines (closer to end of the file)
        CTRL-U          Scroll window up 1 line
        CTRL-D          Scroll window down 1 line
MODIFYING TEXT
        Del key Delete the character under the cursor
        Backspace Delete the character to left of the cursor
        CTRL-N Delete the next word
        CTRL-P Delete the previous word
        CTRL-T Delete tail of line (all characters from cursor to end of line)
        CTRL-O Open up the line (insert line feed and back up)
        CTRL-G Get and insert a file at the cursor position
BUFFER OPERATIONS
        CTRL-@ Set mark at current position for use with CTRL-C and CTRL-K
        CTRL-C Copy the text between the mark and the cursor into the buffer
        CTRL-K Delete text between mark and cursor; also copy it to the buffer
        CTRL-Y Yank contents of the buffer out and insert it at the cursor 
        CTRL-Q Write the contents of the buffer onto a file
MISCELLANEOUS
        numeric + Search forward (prompts for regular expression)
        numeric - Search backward (prompts for regular expression)
        numeric 5 Display the file status
        CTRL-] Go to specific line
        CTRL-R Global replace pattern with string (from cursor to end)
        CTRL-L Line replace pattern with string
        CTRL-W Write the edited file back to the disk
        CTRL-X Exit the editor
        CTRL-S Fork off a shell (use CTRL-D to get back to the editor)
        CTRL-\ Abort whatever the editor was doing and wait for command
        CTRL-E Erase screen and redraw it
        CTRL-V Visit (edit) a new file

# mkdir
Command:        mkdir - make a directory
Syntax:         mkdir directory ...
Flags:          (none)
Examples:       mkdir dir               # Create dir in the current directory
                mkdir /usr/ast/dir      # Create the specified directory
 
     The specified directory or directories are created.  The entries .  
and ..  are inserted into the new directory.

# mkfs
Command:        mkfs - make a file system
Syntax:         mkfs [-lodt] special prototype
Flags:          -l      give a listing on standard output
                -o      use a drive other than A and B (safety precaution)
                -d      use the mod time of the mkfs binary for all files
                -t      skip test of whether the file system fits on the medium
Examples:       mkfs /dev/fd1 proto     # Make a file system on /dev/fd1
                mkfs /dev/fd1 360       # Make empty 360 block file system

     Mkfs builds a file system and copies specified files to it.  The 
prototype file tells which directories and files to copy to it.  If the 
prototype file cannot be opened, and its name is just a string of digits, an 
empty file system will be made with the specified number of blocks.  A sample
mkfs file is:

    boot                                # boot block file (ignored)
    360 63                              # blocks and i-nodes
    d--755 1 1                          # root directory
       bin    d--755 2 1                # /bin: mode (755), uid (2), gid (1)
          sh     ---755 2 1 /user/ast/shell     # shell has mode rwxr-xr-x
          mv     -u-755 2 1 /user/ast/mv        # u = SETUID bit
          login  -ug755 2 1 /user/ast/login     # SETUID and SETGID
       $                                # end of /bin
       dev    d--755 2 1                # /dev: tty (char), fd0 (block)
          tty    c--777 2 1 4 0         # uid=2, gid=1, major=4, minor=0
          fd0    b--644 2 1 2 0 360     # uid, gid, major, minor, blocks
       $                                # end of /dev
       user   d--755 12 1               # /user: mode (755) uid (12), gid (1)
          ast    d--755 12 1            # /user/ast
       $                                # /user/ast is empty
       $                                # end of /user
    $                                   # end of root directory

     Comments are not allowed in a real mkfs file.  The first entry on each
line (except $ lines which close directories) is the name the file or
directory will get on the new file system.  Next comes its mode, with the
first character being -dbc for regular files, directories, block special files
and character special files, respectively.  The next two characters are used
to specify the SETUID and SETGID bits, as shown above.  The last three
characters of the mode are the rwx protection bits.
     Following the mode are the uid and gid.  For special files, the major and 
minor devices are needed.  The size in blocks must also be specified for block 
special files. (The MINIX block size is 1K; this can only be changed by 
changing BLOCK_SIZE and then recompiling the operating system.)

# mknod
Command:        mknod - create a special file
Syntax:         mknod file b/c major minor [size_in_blocks]
Flags:          (none) 
Examples:       mknod /dev/plotter c 7 0 # Create special file for plotter

     Mknod creates a special file named file, with the indicated major and 
minor device numbers.  The second argument specifies a block or character file;
there is no default for this.  The argument giving the maximum size of the
device is optional; MINIX is unlike Unix in having sized devices.

# mkproto
Command:        mkproto - make a mkfs prototype file
Syntax:         mkproto [options] source_directory [prototype_file]
Flags:          -b n    set the file system size to n blocks (default 360)
                -d str  indent using str (default null)
                -g n    set the gid of all files to n (default 1)
                -i n    set the number of inodes to n (default 63)
                -p nnn  set the mode of all files to nnn octal (default 555)
                -s      use the same uid, gid and mode as the originals
                -t path initial path prefix for each entry
                -u n    use n as the uid on all files (default 2)
Example:        mkproto /dev new_dev   # Make a prototype file for /dev

     Mkproto looks at a current system and builds a correctly formed mkfs
prototype file to match.  This is very useful when rebuilding systems, since
it is a lot easier to edit a prototype file than write one from scratch.

# modem
Command:        modem - put a modem into dial-in or dial-out mode
Syntax:         modem [-d] [-g] [-o] [-i rings] line
Flags:          -d      use debug mode
                -g      set permanent dial-in mode (turn uugetty into getty)
                -o      set dial out mode
                -i n    set dial-in mode, and wait n rings before answering
Example:        modem -i6 tty1         # Make tty1 dialin (6 rings)

     Modem allows the same line to be used for dial-in and dial-out..  The -o
flag suspends any getty process associated with the line, and set up the
(Hayes) modem for dialout.  The -i flag restarts a suspended getty, and sets
the modem to answer the phone after the given number of rings.  

     Modem returns the following exit codes: 
        1    ok
        0    error, getty would not listen
       -1    error in utmp file
       -2    tty not found
       -3    process not getty
       -4    process busy
       -5    unknown process type

# more
Command:        more - pager
Syntax:         more [-dflpcsu] [-#] [+linenum | +/pattern] [file ...]
Flags:          -d      display prompt message at each pause
                -f      do not fold lines
                -l      do not treat CTRL-L as form feed
                -p      page mode - clear each page, do not scroll
                -c      clear and redraw one line at a time
                -s      suppress multiple blank lines
                -u      use escape sequences for underlining
                -#      use a window of size #
                -line   start up at line
                -patt   start up two lines before pattern  
Examples:       more file               # Display file on the screen
                more -p file1 file2     # Display two files in page mode
                more -10 file           # Use a ten-line window  
                more +/begin file       # Hunt for the string 'begin'

     More is a pager that allows one to examine files.  This program was 
originally produced at the University of California, Berkeley.  When more  
starts up, it displays a screenful of information from the first file in its 
list, and then pauses for one of the following commands.
        #               integer, how many of something.
        <space>         display next page
        <return>        display next line
        CTRL-B          go backward half a screenful
        CTRL-D          go forward half a screenful
        CTRL-L          redraw the screen
        #<space>        go forward # lines
        =               print current line number
        .               repeat previous command
        '               go back to start of last search (single quote)
        !               escape to shell 
        #/<expr>        go to #th occurrence of <expr>
        :f              display current file name and line number
        #:n             skip forward # files
        #:p             skip backward # files
        b               go backward half a screenful
        d               go forward half a screenful
        #f              skip # screenfulls
        h               display /usr/lib/more.help
        #n              go to #th occurrence of last <expr>
        q               quit
        Q               quit 
        #s              skip # lines
        v               execute /usr/bin/vi
        #z              go forward # lines and set screen size to #

    For the benefit of users who always want to use certain flags when calling 
more, the shell variable MORE can be set to the desired default flags, e.g.  
MORE="-p".  Note that the file more.help should be installed in /usr/lib. 

    Files used: /usr/lib/more.help
                /usr/bin/vi

# mount
Command:        mount - mount a file system
Syntax:         /etc/mount [special_file file_name] [-r]
Flags:          -r       file system is mounted read-only
Examples:       mount                           # Print mounted file systems
                /etc/mount /dev/fd1 /user       # Mount floppy disk 1 on /user
                
     The file system contained on the special file is mounted on filename.
In the example above, the root directory of the file system in drive 1 can be 
accessed as /user after the mount.  When the file system is no longer needed, 
it must be unmounted before being removed from the drive.

     Files used: /etc/mtab

# mref
Command:        mref - make a listing and cross-reference map of MINIX
                mref [-#] [dlmtsx] [p page] file ...
Flags:          -#      print # lines per page (default 50)
                -d      do not produce definition file (symbol table)
                -l      do not produce listing
                -m      multiple references on one line are listed only once
                -p #    set initial page number to #
                -t      generate troff macro call before each page
                -s      suppress line numbering between procedures
                -x      do not produce cross-reference map
Examples:       mref *.[ch]             # List and cross reference files
                mref -60 -t *.c         # Produce troff input at 60 lines/page
                mref -dx -p 100 *.c     # Listing only, first page number 100

     In default mode, mref produces three output files: a numbered listing of
the input files (on standard output), a global symbol table (on symbol.out),
and a cross reference map to the global symbols (on xref.out).  A global
symbol in this context is one present in a #define, PUBLIC, PRIVATE, or SYMBOL
statement (the latter being introduced to allow users to explicitly declare
certain symbols as global). Any of the three outputs can be suppressed, or
alternatively, be made suitable for input to troff for typesetting.

     Files used: /usr/bin/sort

# mv
Command:        mv - move or rename a file
Syntax:         mv file1 file2
                mv file ... directory
Flags:          (none)
Examples:       mv oldname newname      # Move oldname to newname
                mv file1 file2 /usr/ast # Move two files to /usr/ast

     Mv moves one or more files from one place in the file system to another.  
If the old path and new path are on the same device, it is done by linking and
unlinking, otherwise by copying.  Move won't move '.' and '..'.  Move will
allow the owner to move from a non-writable file, but not to one.  Target
files are deleted when moving to a directory.

     Files used: /usr/bin/cp

# nm
Command:        nm - print a symbol table
Syntax:         nm [options] [file] ...
Flags:          -d      address in decimal
                -g      print only external symbols
                -n      sort numerically rather than alphabetically
                -o      prepend file name to each line rather than once only
                -p      print in symbol-table order without sorting
                -r      sort in reverse order
                -u      print only undefined symbols
Examples:       nm -n a.out             # Print all symbols in numerical order
                nm -g a.out             # Print global symbols alphabetically

     Nm prints the symbol table of an executable file when it is available. If
no filename is given, the symbols in a.out are used.  The format of the table
is somewhat compatible with the one produced by asld when used with the -s 
option.  The symbol table can be added with ast.  Archives are not supported,
since assembly language files don't have symbol tables.

# nroff
Command:        nroff - text formatter
Syntax:         nroff [options] [file] ...
Flags:          -       take input from stdin
                +#      start printing at page #
                -#      stop printing at page #
                -a      change font (not implemented in MINIX)
                -b      output device can backspace
                -d      set debug mode (debug output to nroff.dbg)
                -l      output to printer
                -mfile  use macros from /usr/lib/tmac/tmac.file
                -o file set error log file (default is stderr)
                -pl#    set page length n
                -pn#    set initial page number to #
                -po#    set page offset n spaces right   
                -s      step through pages
                -v      print version number to stdout
Examples:  nroff infile >outfile          # Format infile
           nroff +3 -5 infile >outfile    # Only output pages 3-5

     Nroff is a text formatter based on the design in 'Software Tools'.  It
has been modified to closely resemble the Unix nroff.  The program is
described in doc/nroff.1.

    Files used:  /lib/tmac/tmac.*
                 nroff.dbg

# od
Command:        od - octal dump
Syntax:         od [-options] [file] [ [+] offset [.][b] ]
Flags:          -b       dump bytes in octal
                -c       dump bytes as ASCII characters
                -d       dump words in decimal
                -h       print addresses in hex (default is octal)
                -o       dump words in octal (default)
                -x       dump words in hex
Examples:       od -ox file             # Dump file in octal and hex
                od -d file +1000        # Dump file starting at byte 1000
                od -c file +10.b        # Dump file starting at block 10

     Od dumps a file in one or more formats.  If file is missing, standard 
input is dumped.  The offset argument tells od to skip a certain number of 
bytes or blocks before starting.  The offset is in octal bytes, unless it is 
followed by a '.' for decimal or b for blocks or both.

# passwd
Command:        passwd - change a login password
Syntax:         passwd [name]
Flags:          (none)
Examples:       passwd          # Change current user's password
                passwd ast      # Change ast's password (super-user only)

     Passwd is used to change your password.  It prompts for the old and new 
passwords.  It asks for the new password twice, to reduce the effect of a 
typing error.  If /etc is in RAM, do not forget to copy the modified password
file back to the root file system diskette, or the changes will be lost when
the system is shutdown.  Note that there are problems with the Minix password
encryption, which is not particularly secure.

     Files used: /etc/passwd
                 /etc/pwtemp

# paste
Command:        paste - paste multiple files together
Syntax:         paste [-s] [-dlist] file ...
Flags:          -s      print files sequentially, file k on line k
                -dlist  take delimiters used to mark columns from list
Examples:       paste file1 file2       # Print file1 in col 1, file2 in col 2
                paste -s f1 f2 f3 f4    # Print f1 on line 1, f2 on line 2, etc
                paste -s -d'\t\n' f1    # Combine pairs of lines in file f1
                ls | paste - - - -      # Print a directory in four columns
     Paste displays multiple files in parallel.  Suppose a set of k files each 
have one word per line.  Then the paste output will have k columns, with the 
contents of file j in column j.  The columns are separate by tabs unless the 
separator is changed with the -d flag.  If the -s flag is given, then the
first file is on line 1, the second file on line 2, etc.  In effect, -s turns 
the files sideways.

# patch
Command:        patch - update a file from the original and a diff
Syntax:         patch [option] ... old_file diff_file
Flags:          +       change flags between successive patches
                -B pre  next argument is backup filename prefix
                -D lbl  mark changes with "#ifdef...#endif", next arg is label
                -F#     sets a maximum fuzz factor of # (default 2)
                -N      ignore patches that are reversed or already applied
                -R      patch created with old and new files swapped!
                -S      ignore a patch
                -b ext  next argument is backup extension, instead of .orig
                -c      interpret the patch file as a context diff
                -d dir  cd to the next arg (assumed a directory)
                -e      interpret the patch file as an ed script
                -f      forces patch to do its work without asking questions
                -l      do matching loosely (all white space is equivalent)
                -n      interpret the patch file as a normal diff
                -o out  next argument is the output file name
                -p#     sets the pathname strip count to #
                -r fil  names the reject file as fil 
                -v      print program version number
                -s      silent mode
                -x      used for debugging
Example:        patch file difflist             # Fix up file with difflist
                patch <patchfile                # Do it automatically

     Patch takes an original file and a diff listing and recreates the new 
file.  It is functionally similar to fix, but much more powerful.  Not only 
can it handle normal diffs, but also context diffs produced by cdiff.  In 
addition, it works even when the file being patched has other changes to it.  
It deduces the type of difflist itself (unless given -c, -e, or -n).  The 
normal usage is given in the example above.  In this case patch will modify 
'file' to incorporate all the patches.  The original file is renamed 'file~'.
The program is described in doc/patch.doc.

# pr
Command:        pr - print a file
Syntax:         pr [-h hdr] [-llines] [+page] [-col] [-wwidth] [-Mbfnt] file...
Flags:          -M      use Minix-style line numbering, as App. E of OS D & I
                -b      do not allow for backspacing
                -f      do not fold lines 
                -h hdr  take next argument as page header
                -l#     set page length to # lines (default 66)
                -n      use Sys V line numbering
                +#      start printing at page #
                -#      print files in # columns (default 1)
                -t      do not print 5 line page header or trailer
                -w#     set page width to # columns (default 72)
Examples:       pr -w132 -160 file      # Use 132 character line, 60 line page
                pr -3 file              # List file 3 columns to a page
                pr +4 file              # Start printing with page 4

     Pr formats one or more files for printing.  If no files are specified, 
standard input is printed.  Options can be changed between files on a command
line.

# prep
Command:        prep - prepare a text file for statistical analysis
Syntax:         prep [file]
Flags:          (none)
Examples:       prep infile >outfile    # Prep infile
                prep <infile >outfile   # Prep infile

     Prep strips off most of the troff commands from a text file and then 
outputs all the words, one word per line, in the order they occur in the file.
This file can then be sorted and compared to a dictionary (as a spelling 
checker), or used for statistical analyses.

# pretty
Command:        pretty - MINIX pretty printer
Syntax:         pretty file ...
Flags:          (none)
Example:        pretty file1 file2      # Convert two files to MINIX format

     Pretty converts one or more C source files to MINIX format by changing
their layout.  Running this program does not affect the resulting binary
programs.  Actually, pretty is a postprocessor for 'indent', which must be
installed in /bin or /usr/bin.  Although the output is not bad, it is not
entirely consistent with the book or even with itself.

     Files used: /usr/bin/indent

# printenv
Command:        printenv - print out the current environment
Syntax:         printenv
Flags:          (none)
Example:        printenv                # Print the environment

     Printenv prints out the current environment strings, one per line.

# printroot
Command:        printroot - print the root device name on standard output
Syntax:         printroot
Flags:          (none)
Examples:       printroot               # Print the name of the root device
                printroot >/etc/mtab    # Initialise /etc/mtab

     Printroot is useful for initializing the /etc/mtab entry when the system
is booted.  It figures out what the root device is by searching /dev until it
finds a block special file with the right major/minor device numbers.

# ps
Command:        ps - report the process status
Syntax:         ps [-] [alxU] [kernel mm fs]
                -a      print information on all processes except those not
                        associated with a terminal
                -l      print a long format report
                -x      print information on processes not associated with
                        a terminal 
                -U      Create the ps database file 
Example:        ps -ax          # report on processes within the kernel
                ps -l           # long report on the current process group 

     Ps is very similar to the V7 version, but cannot read memory from a core
file.  It requires a database file /etc/psdatbase, or the inclusion of symbol
tables when building in the kernel, mm, and fs.  Fields changed from V7 are
CPU, NICE, and PRI which are missing, RECV which replaces WCHAN, and RUID
and PGRP which are extras.

     Fields displayed with the -l option are: 
        F        process flags @@@ 
        S        process state (Zombie, Waiting, Sleeping, Runnable, Trace) 
        UID      UID of process owner
        PID      PID of process
        PPID     PID of parent process
        PGRP     process group
        ADDR     memory address of the process 
        SZ       size in blocks of the core image
        RECV     process from which messages will be accepted
        TTY      controlling tty
        TIME     cumulative (user + sys) time used by the process
        CMD      command used to start the process

     Files used: /etc/psdatabase

# pwd
Command:        pwd - print the working directory
Syntax:         pwd
Flags:          (none) 
Examples:       pwd             # Print the name of the working directory

     The full path name of the current working directory is printed.

# rcp
Command:        rcp - remote copy
Syntax:         rcp [mach1]!file1 [mach2]!file2
Flags:          (none)
Examples:       rcp file mach1!/usr/ast/x       # Local file to remote machine
                rcp mach2!/usr/ast/x file       # Fetch remote file

     Rcp is not a program.  It is a shell script that does remote copying.  It
makes use of the programs 'to' and 'from'.

# readall
Command:        readall - read a device quickly to check for bad blocks
Syntax:         readall file [-b] [-t]
Flags:          -b      Output a shell script to mark all badblocks found
                -t      Report the total number of blocks found
Example:        readall /dev/hd0                # Read all of /dev/hd0
                readall -t /dev/ram             # Print the ramdisk size

     Readall reads all of the named device in large chunks.  It reports about 
blocks that it cannot read.  Unlike diskcheck, it does not attempt to write on 
the disk, making it safer to use when one is worried about a sick system.

# readclock
Command:        readclock - read the AT's real time clock
Syntax:         readclock
Flags:          (none)
Example:        date `/usr/bin/readclock` </dev/tty     # Useful in /etc/rc

     Readclock reads the AT's real time clock and prints the result in a form 
useful to date, namely, MMDDYYhhmmss.  If the clock does not exist (e.g., on a 
PC), it outputs "-q" to force 'date' to query the user for the time.  The
example given above can be put in /etc/rc to load the real time.  On an AT,
readclock uses a character device /dev/port, major 1 minor 4.

     This is used in the Intel versions of Minix only.

# readfs
Command:        readfs - read a MINIX file system
Syntax:         readfs [-il] block_special [dir]
Flags:          -i      give information about the file, but do not extract
                -l      list the files extracted on standard output
Example: readfs -i /dev/hd2             # See whats on /dev/hd2
         readfs -l /dev/at0 rootfs      # Extract and list the filesystem of
                                        # /dev/at0 and put the tree in the
                                        # directory rootfs
                                        
     Readfs reads a floppy disk containing a MINIX file system and extracts
recursively all directories and files, optionally giving a mkfs listing.  The
files extracted can be put in a user-specified directory (default: current 
directory).  If subdirectories are needed, they will be created automatically.
Special files are extracted as ordinary files, but the mkfs-listing enables
mkfs to restore them to original.

     Files used: /usr/bin/mkdir

# recover
Command:        recover - recover files that have been removed.
Syntax:         recover file ...
Flags:          (none)
Examples:       rm x; recover x         # Unremove x
                recover a b c           # Recover three files

     MINIX allows files that have been deleted (eg. with rm) to be restored.
The trick is that when a file is unlinked, its old i-node number is put in the 
last two bytes of the old file name in the directory.  As long as the directory
entry and disk blocks are not reused, the file can be recovered.  This program
is actually just a front end for de, which must be installed and executable.
Wildcards are not allowed in the filename(s), and only the first twelve
characters of the name are significant.

     Files used: /usr/bin/de

# rev
Command:        rev - reverse the characters on each line of a file
Syntax:         rev [file] ...
Flags:          (none)
Examples:       rev file                # Reverse each line

     Each file is copied to standard output with all the characters of each
line reversed, last one first and first one last.  If no input file is given,
stdin is used.
 
# rm
Command:        rm - remove a file
Syntax:         rm [-fir] name ...
Flags:          -f       forced remove with no questions asked
                -i       interactive remove, ask before removing
                -r       remove directories too
Examples:       rm file                 # Remove file
                rm -i *.c               # Remove .cf files, asking about each

     Rm removes one or more files.  If a file has no write permission, rm asks 
for permission (type 'y' or 'n') unless -f is specified.  If the file is a 
directory, it will be recursively descended and removed if and only if the -r 
flag is present.

     Files used: /usr/bin/rmdir

# rmdir
Command:        rmdir - remove a directory
Syntax:         rmdir directory ...
Flags:          (none)
Examples:       rmdir /usr/ast/foobar           # Remove directory foobar
                rmdir /usr/ast/f*               # Remove 0 or more directories

     The specified directories are removed.  Ordinary files are not removed,
and nor are . and .. .  Directories must be empty.  If a directory that is on
the path is removed, then the pathname is edited appropriately.

# roff
Command:        roff - text formatter
Syntax:         roff [-hs] [+#] [-#] file ...
Flags:          -h      expand tabs to spaces in output
                -s      stop before each page; DEL key restarts
                +#      start printing at page #
                -#      stop after page #
Examples:       roff file               # Run off file
                roff +5 file            # Run off file starting at page 5

     Roff is a text formatter, based on the one in 'Software Tools'; it is
more limited than nroff.  It uses as input the text to be output intermixed
with formatting commands.  A formatting command is a line containing the
control character followed by a two character command name, and possibly one
or more arguments.  The control character is initially '.' (dot).  The
formatted output is produced on stdout.
       The formatting commands are listed below, with n being a number, c 
being a character, and t being a title.  A + before n means it may be signed, 
indicating a positive or negative change from the current value.  Initial 
values for n, where relevant, are given in parentheses.
        .ad     Adjust right margin.
        .ar     Arabic page numbers.
        .br     Line break.  Subsequent text will begin on a new line.
        .bl n   Insert n blank lines.
        .bp +n  Begin new page and number it n.  No n means +1.
        .cc c   Control character is set to c.
        .ce n   Center the next n input lines.
        .de zz  Define a macro called zz.  A line with `..' ends definition.
        .ds     Double space the output.  Same as .ls 2.
        .ef t   Even page footer title is set to t.
        .eh t   Even page header title is set to t.
        .fi     Begin filling output lines as full as possible.
        .fo t   Footer titles (even and odd) are set to t.
        .hc c   The character c (e.g., %) marks where hyphens are permitted. 
        .he t   Header titles (even and odd) are set to t.
        .hx     Header titles are suppressed. 
        .hy n   Hyphenate if n is 1, suppress it if n is 0.  Default is 1.
        .ig     Ignore input lines until a line beginning with `..' is found.
        .in n   Indent n spaces from the left margin; force line break.
        .ix n   Same as .in but continue filling output on current line.
        .li n   Literal text on next n lines.  Copy to output unmodified.
        .ll +n  Line length (including indent) is set to n (65).
        .ls +n  Line spacing is set to n (1).
        .m1 n   Insert n (2) blank lines between top of page and header.
        .m2 n   Insert n (2) blank lines between header and start of text.
        .m3 n   Insert n (1) blank lines between end of text and footer.
        .m4 n   Insert n (3) blank lines between footer and end of page.
        .na     No adjustment of the right margin.
        .ne n   Need n lines.  If fewer are left, go to next page.
        .nn +n  The next n output lines are not numbered.
        .n1     Number output lines in left margin starting at 1.
        .n2 n   Number output lines starting at n.  If 0, stop numbering.
        .ni +n  Indent line numbers by n (0) spaces.
        .nf     No more filling of lines.
        .nx f   Switch input to file f.
        .of t   Odd page footer title is set to t.
        .oh t   Odd page header title is set to t.
        .pa +n  Page adjust by n (1).  Same as .bp
        .pl +n  Paper length is n (66) lines.
        .po +n  Page offset.  Each line is started with n (0) spaces.
        .ro     Page numbers are printed in Roman numerals.
        .sk n   Skip n pages (i.e., make them blank), starting with next one.
        .sp n   Insert n blank lines, except at top of page.
        .ss     Single spacing.  Equivalent to .ls 1.
        .ta     Set tab stops, e.g., .ta 9 17 25 33 41 49 57 65 73 (default).
        .tc c   Tabs are expanded into c.  Default is space.
        .ti n   Indent next line n spaces; then go back to previous indent.
        .tr ab  Translate a into b on output.
        .ul n   Underline the letters and numbers in the next n lines.

# rsh
Command:        rsh - remote shell for networking
Syntax:         rsh port [-bei]
Flags:          -b      start the rsh in the background
                -e      keep stderr separate from stdout
                -i      take input from the local process
Examples:       rsh machine5 ls -l /usr/bin     # List remote bin directory
                rsh abc cat /usr/doc/f >f       # Fetch remote file
                rsh foobar                      # Log onto remote machine

     The remote shell command is the way to have a distant server carry out a 
command over the Ethernet.  The port given as the first argument can be any 
string of up to 6 characters, but it must match the port used by some sherver.
The command will be executed and the results returned on stdout.  Unless the 
-e flag is given, the remote stderr and stdout are merged onto the local 
stdout.  Giving rsh with just a port and no argument is the standard way to 
log onto a remote machine.

# rz
Command:        rz - receive a file using the zmodem protocol
Syntax:         rz [-+Dabcepquvwy] [-t #]
Flags:          -+      append to existing file
                -D      do not actually transfer files
                -a      receive next file as ASCII (CP/M to UNIX translation)
                -b      receive next file as binary
                -c      use 16-bit CRC in XMODEM
                -e      escape for all control characters
                -p      protect file if it already exists
                -q      quiet, overrides verbose
                -t #    set timeout in tenths of a second
                -u      make received pathname upper case
                -v      verbose, more 'v's more info. (uses rzlog.tmp)
                -w      set Zmodem receive window size
                -y      yes, clobber existing file if any
Examples:       rz </dev/tty1 >/dev/tty1        # Receive a file - note file
                                                # name not needed.

     Rz is a program that accepts a file sent from another computer using the
zmodem protocol.  It is a highly complex program, which if called as rb or rx,
operates in YMODEM (batch) or XMODEM mode.  See the description of sz, and the
doc/rz.doc and doc/sz.doc files, for more information.

# sed
Command:        sed - stream editor 
Syntax:         sed [-egn] [-f script_file] [edit_script] [file]
Flags:          -e      accept multiple commands on the command line
                -f fn   take edit script from file fn
                -g      set global flag on all 's' commands
                -n      output selected lines only
Examples:       sed -f script <file             # Run a sed script on file
                sed '/pig/s//hog/g' <file       # Replace pig by hog in file

     Sed is a stream editor.  It takes an edit script either from its argument 
or a file, and performs an edit session on a named file or stdin, producing 
output on stdout.  Its commands are similar to those used in 'ed', qv.

# sh
Command:        sh - shell
Syntax:         sh [file]
Flags:          -c str  execute the commands in str 
                -e      quit on error
                -i      interactive mode; ignore QUIT, TERMINATE, INTERRUPT
                -k      look for name=value everywhere on command line
                -n      do not execute commands
                -q      change qflag from sig_ign to sig_del
                -s      read commands from standard input
                -t      exit after reading and executing one command
                -v      echo input lines as they are read 
                -x      trace
                -u      unset variables
Examples:       sh < script             # Run a shell script

     Sh is the shell, which forms the user's main interface with the system.
On startup, the shell reads /etc/profile and $HOME/.profile, if they exist,
and executes any commands they contain.  The Minix shell has most of the
features of the V7 (Bourne) shell, including redirection of input and output,
pipes, magic characters, background processes, and shell scripts.  A few of
the more common commands are listed below:

date                    # Regular command
sort <file              # Redirect input
sort <file1 >file2      # Redirect input and output
cc file.c 2>error       # Redirect standard error
a.out >f 2>&1           # Combine standard output and standard error
sort <file1 >>file2     # Append output to file2
sort <file1 >file2 &    # Background job
(ls -l; a.out) &        # Run two background commands sequentially
sort <file | wc         # Two-process pipeline
sort <f | uniq | wc     # Three-process pipeline
ls -l *.c               # List all files ending in .c
ls -l [a-c]*            # List all files beginning with a, b or c
ls -l ?                 # List all one-character file names
ls \?                   # List the file whose name is a question mark
ls '???'                # List the file whose name is three question marks
v=/usr/ast              # Set shell variable v
ls -l $v                # Use shell variable v
PS1='Hi!'               # Change the primary prompt to Hi!
PS2='More:'             # Change the secondary prompt to More:
ls -l $HOME             # List the home directory
echo $PATH              # Echo the search path
if...then...else...fi   # If statement
for...do...done         # Iterate over argument list
while...do...done       # Repeat while condition holds
case...esac             # Select clause based on condition
echo $?                 # Echo exit status of previous command
echo $$                 # Echo shell's pid
echo $#                 # Echo number of parameters (shell script)
echo $2                 # Echo second parameter (shell script)
echo $*                 # Echo all parameters (shell script)

     Files used:  /etc/profile
                  $HOME/.profile

# shar
Command:        shar - shell archiver
Syntax:         shar file ...
Flags:          (none)
Examples:       shar *.c .s             # Collect C programs in shell archive
                sh <s                   # Extract files from a shell archive

     The named files are collected together into a shell archive written onto 
standard output.  The individual files can be extracted by redirecting the 
shell archive into the shell.  The advantage of shar over ar is that shar 
archives can be read on almost any UNIX system, whereas numerous, incompatible 
versions of ar are in widespread use.  Extracting the files from a shell 
archive requires that gres is accessible.  In the distribution, gres is in 
/user/bin rather than /usr/bin.

# sherver
Command:        sherver - shell server
Syntax:         sherver port
Flags:          (none)
Example:        sherver m1              # Start a sherver listening to port m1

     The rsh command does its remote execution by doing a remote procedure 
call to some sherver.  The sherver executes the command and then exits.  
Usually a master will be running to start a new sherver.  Because shervers get 
their input from a pipe, remote execution cannot handle signals and CTRL-D, 
because they cannot be sent down a pipe.

# sind
Minix 1.5.10 short file index.

[               animals         ar              ascii           asld
ast             at              atob            atrun           backup
badblocks       banner          basename        bawk            btoa
cal             cat             cc              cdiff           cgrep
chgrp           chip            chmem           chmod           chown
ci              clr             cmp             co              comm
compress        cp              cpdir           crc             cron
cut             date            dd              de              df
dhrystone       diff            dis88           diskcheck       dosdir
dosread         doswrite        du              echo            ed
elle            expand          expr            factor          fdisk
fgrep           file            find            fix             fold
fortune         from            fsck            gather          getlf
getty           grep            gres            head            help
ic              id              ifdef           indent          inodes
kermit          kill            last            leave           libpack
libupack        ln              login           look            lorder
lpr             ls              m4              machine         mail
make            man             master          mined           mkdir
mkfs            mknod           mkproto         modem           more
mount           mref            mv              nm              nroff
od              passwd          paste           patch           pr
prep            pretty          printenv        printroot       ps
pwd             rcp             readall         readclock       readfs
recover         rev             rm              rmdir           roff
rsh             rz              sed             sh              shar
sherver         size            sleep           sort            spell
split           strings         strip           stty            su
sum             svc             svclog          sync            sz
tail            tar             tee             term            termcap
test            time            to              touch           tr
traverse        treecmp         true            tset            tsort
ttt             tty             umount          uncompress      unexpand
uniq            unshar          update          users           uud
uue             vol             wc              whatsnew        whereis
which           who             whoami          width           write
zcat

# size
Command:        size - print the text, data, and bss sizes of a program
Syntax:         size [file] ...
Flags:          (none)
Examples:       size                    # Print the sizes of a.out
                size filename           # Print the sizes of filename

     The text, data, bss, and total sizes for each argument are printed.  If 
no arguments are present, a.out is assumed.  The amount of memory available 
for combined stack and data segment growth is printed in the column 'stack.' 
This is the value manipulated by the chmem command.  The total amount of 
memory allocated to the program when it is loaded is listed under 'memory.' 
This value is just the sum of the other four columns.
 
# sleep
Command:        sleep - suspend execution for a given number of seconds
Syntax:         sleep seconds
Flags:          (none)
Examples:       sleep 10                # Suspend execution for 10 seconds

     The caller is suspended for the indicated number of seconds.  This 
command is typically used in shell scripts.

# sort
Command:        sort - sort a file of ASCII lines
Syntax:         sort [-bcdfimnru] [-tx] [-o name] [+pos1] [-pos2] file ...
Flags:          -       use stdin as input
                -b      skip leading blanks when making comparisons
                -c      check to see if a file is sorted
                -d      dictionary order, ignoring punctuation bar '.' and ','
                -f      fold upper case to lower case
                -i      ignore characters outside ASCII range (040-0176)
                -m      merge presorted files
                -n      numeric sort order, optional decimal point
                -o fn   next argument is output file
                -r      reverse the sense of comparisons
                -tx     character x is field separator
                -u      unique mode, deleting duplicate lines
                +#.#    (field.offset) start comparing at field #., offset .#
                -#.#    (field.offset) stop comparing at field #., offset .#
                        (a missing offset is taken to be 0)
                        (a missing field.offset means the rest of the line)
Examples:       sort -nr file           # Sort keys numerically, reversed
                sort +2 -4 file         # Sort using fields 2 and 3 as key
                sort +2 -t: -o out      # Field separator is :
                sort +.3 -.6            # Characters 3 through 5 form the key

     Sort sorts one or more files.  If no files are specified, standard input 
is sorted.  Output is written on standard output, unless -o is specified.  The 
options +pos1 -pos2 use only fields pos1 up to but not including pos2 as the 
sort key, where a field is a string of characters delimited by spaces and 
tabs, unless a different field delimiter is specified with -t.  Both pos1 and 
pos2 have the form m.n where m tells the number of fields and n tells the 
number of characters.  Either m or n may be omitted.

# spell
Command:        spell - print the words in a file that are not in a dictionary
Syntax:         spell file
Flags:          (none)
Example:        spell document          # Print the spelling errors on stdout

     Spell is the MINIX spelling checker, a shell script.  First, the program
prep strips off the roff, nroff, and troff control lines and the punctuation,
listing each word on a separate line.  It then sorts the output and compares
it to the dictionary.  Words present in the file but not present in the
dictionary are written to stdout.  The dictionary is kept in /usr/lib.

     Files used: /usr/lib/dictionary

# split
Command:        split - split a large file into several smaller files
Syntax:         split [-#] [file [prefix]]
Flags:          -#      number of lines per piece (default 1000)
Examples:       split -200 file         # Split file into pieces of 200 lines
                split file z            # Split file into zaa, zab, etc.

     Split reads file and writes it out in n-line pieces.  By default, the 
pieces are called xaa, xab, etc.  The optional second argument can be used to 
provide an alternative prefix for the output file names.

# strings
Command:        strings - print all the strings in a binary file
Syntax:         strings [-] [-o] [-#] file ...
Flags:          -        search whole file, not just data seg
                -o       print octal offset of each string
                -#       minimum length string # (default 4)
Examples:       strings -5 a.out        # Print all strings >= 5 char in a.out
                strings - /bin/sh       # Search entire shell file

     Strings looks for sequences of printable characters followed by a null or
newline.  These are usually strings.  This program is typically used to help
identify unknown binary programs and to identify the source of eg. core dumps.

# strip
Command:        strip - remove a symbol table from an executable file
Syntax:         strip [file] ...
Flags:          (none)
Example:        strip foo               # Remove symbols from foo

     For each file argument, strip removes the symbol table.  Strip makes a 
copy of the file being stripped, so links are lost.  When no file is present,
a.out is assumed.

# stty
Command:        stty - set the terminal parameters
Syntax:         stty [option ...]
Flags:          (none)
Examples:       stty -echo              # Suppress echoing of input
                stty erase #            # Set the erase character to #
                stty </dev/tt1          # Print terminal tty1 parameters

     When given no arguments, stty prints the current terminal parameters.  It 
can also be used to set the parameters, as follows:
                cbreak          enter cbreak mode, erase and kill disabled
                echo            echo input on the terminal
                nl              accept only line feed to end lines
                raw             enter raw mode, no input processing at all
                tabs            output tabs (do not expand to spaces)
                erase c         set erase character (initially backspace)
                int c           set interrupt (SIGINT) char. (initially DEL)
                kill c          set kill line character (initially @)
                quit c          set quit (SIGQUIT) character (initially CTRL-\)
                default         set options back to original values
                even            set even parity
                odd             set odd parity
                [5-8]           set bits per word
                [110-9600]      set baud rate

     The first five options may be prefixed by - as in -tabs to turn the 
option off.  The next four options each have a single character parameter 
separated by a space from the option.  The default option sets the mode and 
the four settable characters back to the values they had when the system was  
booted.  It is useful when a rogue program has messed them up.

# su
Command:        su - temporarily log in as super-user or another user
Syntax:         su [name]
Flags:          (none)
Examples:       su                      # Become super-user
                su ast                  # Become ast

     Su can be used to temporarily login as another user.  It prompts for the 
super-user password.  If the correct password is entered, su creates a shell 
with the desired uid.  If no name is specified, root is assumed.  To exit the 
temporary shell, type CTRL-D.

# sum
Command:        sum - compute the checksum and block count of a file
Syntax:         sum file 
Flags:          (none)
Examples:       sum /usr/ast/xyz        # Checksum /usr/ast/xyz

     Sum computes the checksum of one or more files.  It is most often used to 
see if a file copied from another machine has been correctly received.  This 
program works best when both machines use the same checksum algorithm.

# svc
Command:        svc - shell version control system
Syntax:         ci [-l] [u] file
                co [-l] [r rev] file
                svclog file
Flags:          -l      for ci, checkin, checkout again, and lock file
                -l      for ci, checkout file and then lock the archive
                -u      after checking in, do not delete the file
                -r #    check out revision # instead most recent revision
Examples:       ci -u file              # Check in file
                co -l file              # Check out file and lock archive
                co -r 2 file            # Check out version 2
                svclog foo              # Print out revision history for foo
 
     SVC is the Shell Version Control system, patterned on RCS.  It maintains
a sequence of versions in archive files, so that new versions can be checked
in (added to the archive), and old versions can be checked out (made
available).  To create an archive for file, check it in with the -u flag.
This action will prompt for a log message and then create an archive called
file,S in the current directory, or in the subdirectory SVC if it exists.  The
file will not be deleted, but will be made unwritable.  Depending on how they
are compiled, ci and co rely on either fix or patch to do the actual work of
updating files.
     To update a file, check it out with the -l flag.  Then modify it, and
check it back in, giving a new message when prompted.  After this process has
been repeated many times, the archive will contain the entire history.  Any
version can be checked out using the -r flag.  To get a printout of the
history, use svclog.
     See also the descriptions of ci, co, and svclog. 

     Files used: /bin/patch, /bin/fix

# svclog
Command:        svclog - print a log of SVC revisions
Syntax:         svclog file
Flags:          (none)
Examples:       svclog foo              # Print out revision history for foo
                svclog file,S           # Print out revision history for file

   Svclog is a shell script that prints out the revision history of the
specified file.  This information includes the revision numbers, dates, and
log entries for each of the revisions, and indicates whether or not a lock on
this file exists.  For simplicity, the output format is rather raw.  See also
the descriptions of ci, co, and svc.

# sync
Command:        sync - flush the cache to disk
Syntax:         sync
Flags:          (none)
Examples:       sync                    # Write out all modified cache blocks

     MINIX maintains a cache of recently used disk blocks.  The sync command 
writes any modified cache blocks back to the disk.  This is essential before 
stopping the system, and should be done before running any a.out program that 
might crash the system.  Logging out with CTRL-D does an automatic sync.

# sz
Command:        sz - send a file using the zmodem protocol
Syntax:         sz [-+CLNabdefnopqruvy] [ci command] [Ll #] [t timeout]
Flags:          -+      append to an existing file
                -C #    set command retries to #
                -L #    use n-byte packets
                -N      overwrite if source is newer/longer
                -T      test mode
                -X      use XMODEM mode
                -Y      @@@
                -a      ASCII file mode
                -b      binary file mode
                -c      send command for execution
                -d      convert dot to slash in names
                -e      escape for all control characters
                -f      send full path name
                -i      send a command and exit
                -l #    flow control every # packets
                -n      overwrite destination if source is newer
                -o      use old (16-bit) checksum
                -p      protect file if it already exists
                -q      quiet mode, overrides verbose
                -r      resume interrupted file transfer
                -t #    set timeout in tenths of a second
                -u      unlink file after successful transmission
                -v      verbose, more 'v's more info.
                -y      yes, clobber existing files
Examples:       sz file </dev/tty1 >/dev/tty1# Send file

     Sz is a program that accepts a file sent from another computer using the
zmodem protocol.  It is a highly complex program, which if called as sb or sx,
operates in YMODEM (batch) or XMODEM mode.  See the description of rz, and the
doc/sz.doc and doc/rz.doc files, for more information.

# tail
Command:        tail - print the last few lines of a file
Syntax:         tail [+/-[number][lc]] [file] ...
Flags:          +/-     amount to print
                -l      count by lines
                -c      count by characters 
Examples:       tail -6         # Print last 6 lines of standard input
                tail +6 file1   # Print all but the first 6 lines of file1

     The last few lines or characters of one or more files are printed.  The
default count is 10 lines.  The default file is standard input.

# tar
Command:        tar - tape archiver
Syntax:         tar [ctx] [ov] [F] [f] tarfile [file] ...
Flags:          -       use stdin/stdout as appropriate
                F       ignore errors
                c       create a new archive
                f       not implemented under Minix
                o       chown/chgrp files (only if super user)
                t       print a table listing the archive's contents
                v       verbose mode
                x       extract the named files from the archive
Examples: tar c /dev/fd1 file1 file2    # Create a two-file archive
          tar xv /dev/fd1 file1 file2   # Extract two files from the archive
          (cd src; tar c -) | (cd dest; tar x -) # Move src tree to dest

     Tar is an archiver in the style of the standard tape archiver, except 
that it does not use tape.  It's primary advantage over ar is that the tar  
format is somewhat more standardized than the ar format, making it 
theoretically possible to transport MINIX files to another computer, but do 
not bet on it.  If the target machine runs MS-DOS, try doswrite.

     Files used: /usr/bin/mkdir

# tee
Command:        tee - divert standard input to a file
Syntax:         tee [-ai] file ...
Flags:          -a       append to the files, rather than overwriting
                -i       ignore interrupts
Examples:       cat file1 file2 | tee x # Save and display two files
                pr file | tee x | lpr   # Save the output of pr on x

     Tee copies standard input to standard output.  It also makes copies on 
all the files listed as arguments.

# term
Command:        term - turn an IBM PC into a dumb terminal
Syntax:         term [commdev] [baudrate] [parity] [bits_per_character]
Flags:          (none)
Examples:       term 2400               # Talk to modem at 2400 baud
                term 1200 7 even        # 1200 baud, 7 bits/char, even parity
                term /dev/tty2          # Use tty2 instead of tty1

     Term allows MINIX to talk to a terminal or modem over an RS-232 port.  It
uses /dev/tty1 as the default, which can be changed on the command line.  The
program first sets the baudrate, parity and character length, and then forks.
The parent sits in a loop copying from standard input (usually the console's
keyboard), to the terminal or modem.  The child sits in a loop copying from
the terminal or modem to standard output.  Thus when an RS-232 port is
connected to a modem, every keystroke typed on the keyboard is sent to the
modem, and every character arriving from the modem is displayed. Standard
input and output may be redirected, to provide a primitive file transfer
program, with no checking.
     To use term, it is essential that /etc/ttys is configured so that there
is no shell hanging on the tty device used.  If there is, both the shell and
term will try to read from the tty, and nothing will work.  To exit term,
press the middle button on the numeric pad on the IBM PC.

     This is used in the Intel versions of Minix only.

# termcap
Command:        termcap - print the current termcap entry
Syntax:         termcap [type]
Flags:          (none)
Example:        termcap                 # Print the termcap entry

     Termcap reads the /etc/termcap entry corresponding to the terminal type 
supplied as the argument.  If none is given, the current $TERM is used.  It 
then prints out all the parameters that apply.

     Files used: /etc/termcap

# test
Command:        test - test for a condition
Syntax:         test expr
Flags:          (none)
Example:        test -r file            # See if file is readable
                if [ -f file ]          # Use [ format

     Test checks to see if files exist, are readable, etc.  and returns an 
exit status of zero if true and non-zero if false.  The legal operators are:

        -r file         true if the file is readable
        -w file         true if the file is writable 
        -f file         true if the file is not a directory
        -d file         true if the file is a directory
        -s file         true if the file exists and has a size > 0
        -t fd           true if file descriptor fd (default 1) is a terminal
        -z s            true if the string s has zero length
        -n s            true if the string s has non-zero length
        s1 = s2         true if the strings s1 and s2 are identical
        s1 != s2        true if the strings s1 and s2 are different
        m -eq m         true if the integers m and n are numerically equal

     The operators -gt, -ge, -ne, -le, -lt may be used as well.  These operands
may be combined with -a (Boolean and), -o (Boolean or), ! (negation).  The 
priority of -a is higher than that of -o.  Parentheses are permitted, but must 
be escaped to keep the shell from trying to interpret them.
     If test is linked to /usr/bin/[ structures such as if [ -f file ] can be
used to improve clarity.

# time
Command:        time - report how long a command takes
Syntax:         time command
Flags:          (none)
Examples:       time a.out              # Report how long a.out takes
                time ls -l *.c          # Report how long the command takes

     The command is executed and the real time, user time, and system time (in
seconds) are printed.

# to
Command:        to - output half of a connection
Syntax:         to port
Flags:          (none)
Example:        cat f1 f2 | to mach4    # Send the catted files to port

     To and from are used together to provide connection-oriented service.  On 
the sending machine, the last member of a pipeline is 'to port'.  On the 
receiving machine, the first member of a pipe line is 'from port'.  The net 
result is that the output of the sending pipeline goes into the input of the 
receiving pipeline, making pipelines work across the network.  As a simple 
example, consider:
        on machine1:    cat f1 f2 | to Johnny
        on machine2:    from Johnny | sort >x

     The effect of these two commands is that the files f1 and f2 are 
concatenated, transferred to machine 2, and sorted their, with the output 
going to a file x on machine 2.  The string Johnny is used by the transaction 
system to identify which sender goes with which receiver; any unique string 
can be used.

# touch
Command:        touch - update a file's time of last modification
Syntax:         touch [-cf] file ...
Flags:          -c      do not create the file
                -f      Minix ignores this flag
Examples:       touch *.h               # Make the .h files look recent

     The time of last modification is set to the current time.  This command 
is mostly used to trick make into thinking that a file is more recent than it 
really is.  If the file being touched does not exist, it is created, unless 
the -c flag is present.
 
# tr
Command:        tr - translate character codes
Syntax:         tr [-cds] [string1] [string2]
Flags:  -c      complement the set of characters in string1
        -d      delete all characters specified in string1
        -s      squeeze all runs of characters in string1 to one character
Examples: tr '[a-z]' '[A-Z]' <x >y      # Convert lower case to upper case
          tr -d '0123456789' <f1 >f2    # Delete all digits from f1

     Tr performs simple character translation.  When no flag is specified, 
each character in string1 is mapped onto the corresponding character in 
string2.

# traverse
Command:        traverse - print the directory tree under a named directory
Syntax:         traverse [dir]
Flags:          (none)
Example:        traverse /              # Print tree starting at root

     Traverse prints the tree structure starting at the named directory.  All 
the subdirectories are listed, with the depth shown by indentation.  The 
default is the current working directory.

# treecmp
Command:        treecmp - recursively list differences in two directory trees
Syntax:         treecmp [-cv] dir1 dir2
Flags:          -c      list the names of changed and new files only
                -v      list all directories processed (verbose)
Example:        treecmp -v /usr/ast/V1 /usr/ast/V2      # Compare two trees

     Treecmp recursively descends the directory tree of the second argument
and compares all files to those at the corresponding position in the first
argument.  If the two trees are identical, i.e., all the corresponding 
directories and files are the same, there is no output.  Otherwise, a list of 
files missing from one of the trees or present in both but whose contents are 
not identical in both are printed.

# true
Command:        true - exit with the value true
Syntax:         true
Flags:          (none)
Examples:       while true              # List the directory until DEL is hit
                do ls -l
                done

     This command returns the value true.  It is used for shell programming,
and consists of a zero-length file (work it out).  It is distributed with
the shell script files.

# tset
Command:        tset - set the $TERM variable
Syntax:         tset [device]
Flags:          (none)
Example:        eval `tset`             # In .profile, logs into any terminal
                eval `tset dev_typ`     # Change $TERM during a session

     Tset is used almost exclusively to set the shell variable TERM from 
inside .profile files.  If an argument is supplied it is used as the value
of TERM.  Otherwise tset looks in /etc/ttytype for the value associated with
the current port.

     Files used: /etc/ttytype

# tsort
Command:        tsort - topological sort
Syntax:         tsort [infile] [outfile]
Flags:          (none)
Example:        ar cr libc.a `lorder *.s | tsort`       # Build library

     Tsort accepts a file of lines containing ordered pairs and builds a total
ordering from the partial orderings.

# ttt
Command:        ttt - tic tac toe
Syntax:         ttt
Flags:          (none)
Examples:       ttt                     # Start the game

     This program allows the user to engage in a game of tic tac toe (noughts 
and crosses) with the computer.  The program uses the alpha-beta algorithm, so 
the user had better be sharp.

# tty
Command:        tty - print the device name of this tty
Syntax:         tty
Flags:          -s      silent mode (return status only)
Example:        tty                     # Print the tty name

     Print the name of the controlling tty.

# umount
Command:        umount - unmount a mounted file system
Syntax:         umount special
Flags:          (none)
Examples:       umount /dev/fd1    # Unmount floppy disk 1

     A mounted file system is unmounted after the cache has been flushed to 
disk.  A floppy disk should never be removed while it is mounted.  If this
happens, and is discovered before another floppy disk is inserted, the 
original one can be replaced without harm.  Attempts to unmount a file system 
holding working directories or open files will be rejected with a 'device 
busy' message.

    Files used: /etc/mtab

# uncompress
Command:        uncompress - decompress a file using modified Lempel-Ziv coding
Syntax:         uncompress [flags] [file.Z] ...
Flags:          -V      give version number and compression statistics 
                -c      put output on standard output instead of on file
                -q      quiet mode
                -n      ignore header information (to decompress old files)
                -v      give compression statistics
Examples:       uncompress file.z       # Decompress file.Z to file 

     Uncompress is a link to the file 'compress', qv., and is the same as
'compress -d'; it decompresses a file to a file with the original filename.
Similarly, a link to 'zcat' decompresses to standard output by default.

# unexpand
Command:        unexpand - convert spaces to tabs
Syntax:         unexpand [-a] [file] ...
Flags:          -a      all spaces are unexpanded
Example:        unexpand one two >new       # Change leading spaces to tabs

     Unexpand replaces spaces in the named files with tabs.  If no files are
listed, standard input is given.  The -a flag is used to force all sequences
of spaces to be expanded, instead of only leading spaces.

# uniq
Command:        uniq - delete consecutive identical lines in a file
Syntax:         uniq [-cdu] [+#] [-#] [input [output]]
Flags:          -#      skip the first # spaces when matching 
                +#      skip the first # fields when matching
                -c      give count of identical input lines
                -d      write only duplicate lines to output
                -u      write only unique lines to output
Examples:       uniq +2 file            # Ignore first two fields in matching
                uniq -d in out          # Write duplicate lines to file out

     Uniq examines a file for consecutive lines that are identical.  All but 
duplicate entries are deleted, and the file is written to output.  When both
fields and spaces are being skipped, fields are skipped first. 

# unshar
Command:        unshar - extract files from a shell archive
Syntax:         unshar [-tbv] [-xoutfile] [file] ...
Flags:          -b      @@@
                -t      list the names of the files in the shar file
                -v      verbose mode
                -xfn    extract file 'fn' from the shar file 
Examples:       unshar -xsf file.shar   # extract sf from file.shar

     Unshar is a quick method of extracting files from shell archives: much
quicker than feeding an archive into a shell.  It will also extract single
files from an archive.  It understands archives made with sed, gres and cat.

# update
Command:        update - write the buffer cache to disk regularly 
Syntax:         update
Flags:          (none)
Examples:       /etc/update &   # Start a background flush of the cache

     When the system is booted, update is started up in the background from
/etc/rc to issue a 'sync' system call every 30 sec.

# users
Command:        users - list the logged-in users
Syntax:         users
Flags:          (none)
Examples:       users                   # List the users

     Users prints a single line of text containing the names of all the 
currently logged-in users from /usr/adm/wtmp, if logging is enabled.  

     Files used: /usr/adm/wtmp

# uud
Command:        uud - decode a binary file encoded with uue
Syntax:         uud [-nd] [-s srcdir] [-t dstdir] file
Flags:          -       take input from stdin
                -d      debugging information
                -n      do not verify checksums
                -s dir  get .uue (source) file from directory dir
                -t dir  put output in (target) directory dir
Examples:       uud file.uue            # Re-create the original file
                uud - <file.uue         # Take input from stdin

     Uud decodes a file encoded with uue or UNIX uuencode.  The decoded file is
given the name that the original file had.  The name information is part of the
encoded file.  Mail headers and other junk before the encoded file are skipped.
     See also the description of uue.

# uue
Command:        uue - encode a binary file using ASCII
                uue [-#] file [-]
Flags:          -       output to stdout
                -#      maximum of # lines per file
Examples:       uue file                # Encode file to file.uue
                uue file - >x           # Encode file and write on stdout
                uue -800 file           # Output on file.uaa, file.uab etc.

     Uuuencode is a famous program that converts an arbitrary (usually binary)
file to an encoding using only 64 ASCII characters.  Uudecode converts it back
to the original file.  The uue and uud programs are the MINIX versions of these
programs, and are compatible with the UNIX ones.  The files produced can even
be sent successfully over BITNET, which is notorious for mangling files.
     It is possible to have uue automatically split the encoded file up into
chunks small enough to fit into mail messages.  The output files then get the
suffixes .uaa, .uab, etc., instead of .uue.  When uud is given file .uaa to
decode, it automatically includes the subsequent pieces.  The encoding takes
3 bytes (24 bits) from the input file and renders it as 4 bytes in the output
file.  See also the description of uud.

# vol
Command:        vol - split the standard input into diskette-sized volumes
Syntax:         vol [-u] size block-special
Flags:          -u      unsave from diskettes
Examples:       tar c - . | vol 360 /dev/fd0    # Prompt for disk every 360K
                vol -u 360 /dev/fd0 | tar x -   # Restore a saved file system

     It occasionally happens that a program generates an output stream 
intended for diskette but the stream is to large to fit on one diskette.  Vol 
is a program that accepts a continuous stream, and pauses every 'size' blocks
to request a new diskette to be inserted.  This makes it possible to save
arbitrarily long streams on a series of diskettes, as shown above.

# wc
Command:        wc - count characters, words, and lines in a file
Syntax:         wc [-clw] file ... 
Flags:          -c       print character count
                -l       print line count
                -w       print word count
Examples:       wc file1 file2          # Print all three counts for both files
                wc -l file              # Print line count only

     Wc reads each argument and computes the number of characters, words and 
lines it contains.  A word is delimited by white space (space, tab, line feed
or form feed).  The default is to print all three counts in the order l,w,c.

# whatsnew
Command:        whatsnew - print a newly modified file, marking changes
Syntax:         whatsnew [-#] file.c file.c.cdif
Flags:          -#      set output line length to # (default 80)
Examples:       whatsnew file.c file.c.cdif     # Print file.c marking changes
                whatsnew -70 file.c file.c.cdif # As above, with 70 column line

     It often occurs that cdifs are posted to USENET. After installing a cdif
file, it is sometimes desirable to print out the new file, with the changes
marked on it.  Whatsnew does precisely this, with the changes + and ! printed
in the right-hand margin.  Output lines are forced to a standard length to
make the symbols easy to find.

# whereis
Command:        whereis - examine the system directories for a given file
Syntax:         whereis file
Flags:          (none)
Example:        whereis stat.h          # Prints "/usr/include/sys/stat.h"
        
     Whereis is a shell script that searches a fixed set of directories, /bin,
/lib, /usr/bin, and others, and prints all occurrences of the argument name
in any of them.

# which
Command:        which - examine $PATH to see which file will be executed
Syntax:         which name ...
Flags:          (none)
Example:        which a.out             # Tells which a.out will be executed

     The $PATH shell variable controls the MINIX search rules. If a command
a.out is given, which first tries to find an executable file in the working
directory.  If that fails, it looks in various system directories, such as
/bin and /usr/bin.  The which command makes the same search and gives the
path of the program that will be chosen.

# who
Command:        who - print a list of currently logged in users
Syntax:         who [user | device | am i]
Flags:          (none)
Example:        who                     # Print user names, terminals and times
                
     Who prints a list of currently logged in users.  For each one, the user 
name, terminal, and login time is printed.  By default, the program gets its
information from the file /etc/utmp (if it exists), which is normally
updated by init and login.  If the optional filename is given, the logins in
that file will be printed.  Do not confuse whoami with 'who am i'.

     Files used: /etc/utmp

# whoami
Command:        whoami - print the current user name
Syntax:         whoami
Flags:          (none)
Example:        whoami                  # Print user name

     In case you forget who you are logged in as, whoami will tell you.  If 
you use su to become somebody else, whoami will give the current effective 
user.  Do not confuse this with the command 'who am i'.

# width
Command:        width - force all the lines of a file to a given width
Syntax:         width [-n [ infile [outfile] ]
Flags:          -#      set line length to # columns (default 80)
Examples:       width -60 x y           # Copy x to y, force lines to 60 cols
                width x                 # Copy 80 column lines to stdout

     The input file is copied to the output file.  All lines are forced to a
given size by padding with spaces or truncating.  Tabs are expanded to spaces.

# write
Command:        write - send a message to a logged-in user
Syntax:         write [-cv] user [tty]
Flags:          -c      use cbreak mode
                -v      verbose mode
Examples:       write ast               # Send a message to ast
                write ast tty1          # Send a message to ast on tty0

     Write lets a user send messages to another logged-in user.  Lines typed by
the user appear on the other user's screen a line at a time (a character at a
time in the case of cbreak mode).  The file /etc/utmp is searched to find out
which tty to send the message to.  If the user is logged onto more than one
terminal, the tty argument selects the terminal.  Type CTRL-D to terminate the
command.  Use ! as a shell escape, except when in cbreak mode.

    Files used: /etc/utmp

# compress
Command:        zcat - decompress a file using modified Lempel-Ziv coding
Syntax:         zcat [flags] [file.Z] ...
Flags:          -V      give version number and compression statistics 
                -q      quiet mode
                -n      ignore header information (to decompress old files)
                -v      give compression statistics
Examples:       zcat file.Z >outfile       # Decompress file to stdout

     Zcat is a link to the file 'compress', qv., and is the same as
'compress -c'.  Similarly, a link to 'uncompress' decompresses to a file with
the same name as the original.
