home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-07 | 86.8 KB | 2,518 lines |
- echo x - animals
- sed '/^X/s///' > animals << '/'
- X.CD "animals \(en twenty-questions type guessing game about animals"
- X.SX "animals\fR [\fIdatabase\fR]"
- X.FL "\fR(none)"
- X.EY "animals" "Start the game"
- X.PP
- X\fIAnimals\fR is a guessing game. The user picks an animal and the
- Xcomputer tries to guess it by posing questions that should be answered by
- Xtyping \*(OQy\*(CQ for yes and \*(OQn\*(CQ for no.
- XWhenever the computer loses, it asks
- Xsome questions that allow it to improve its database, so as time goes on, it
- Xlearns. The default database should be in \fI/usr/lib/animals\fR.
- X
- X
- X
- X.SP 0.3
- /
- echo x - anm
- sed '/^X/s///' > anm << '/'
- X.CD "anm \(en print name list [68000]"
- X.SX "anm \fR[\fB\(engnoprus\fR] \fIfile\fR ..."
- X.FL "\(eng" "Global symbols only"
- X.FL "\(enn" "Sort numerically"
- X.FL "\(eno" "Prepend the filename to each line"
- X.FL "\(enp" "No sorting\(emuse symbol table order"
- X.FL "\(enr" "Sort in reverse order"
- X.FL "\(enu" "List undefined symbols only"
- X.FL "\(ens" "Sort in section order"
- X.EY "anm \(engn test.o" "Print global symbols in numerical order"
- X.PP
- X.I Anm
- Xprints the name list (symbol table) of each ACK format object
- X.I file
- Xin the argument list.
- XIf no file name is given, \fIa.out\fR is used.
- XEach symbol name is preceded by its value, a section indicator
- Xand a type indicator.
- XThe section indicators are:
- X.SP 0.7
- X.HS
- X.ta 0.25i 0.50i
- X.nf
- X \fBU\fR Undefined symbol
- X \fBA\fR Absolute symbol
- X \fB\(en\fR Other symbol
- X.sp
- XThe type indicators are:
- X.HS
- X \fBF\fR Filename
- X \fBM\fR Module name
- X \fBS\fR Section name
- X \fBE\fR External (global) symbol
- X \fB\(en\fR Local symbol
- X.fi
- X.PP
- XThe output is sorted alphabetically, unless otherwise specified.
- XNotice that \fIanm\fR can only be used on ACK format object files
- X(that is: \fI.o\fR and \fI.out\fR files).
- XIf you want to get the name list of an executable program use
- X.I nm
- Xinstead.
- X
- X
- X
- /
- echo x - aoutdump
- sed '/^X/s///' > aoutdump << '/'
- X.CD "aoutdump \(en display the contents of an object file [68000]"
- X.SX "aoutdump \fR[\fIfile\fR [\fIabcdef\fR] ]"
- X.FL "\fR(none)"
- X.EY "aoutdump test.o 000010" "dump the symbol table records of \fItest.o\fR"
- X.PP
- X.I Aoutdump
- Xgives a complete dump of each ACK formatted object
- X.I file
- Xin the argument list.
- XIf no
- X.I file
- Xis given, \fIa.out\fR is displayed.
- XThe parameter following the file name is a bit map that
- Xcan be used to specify a partial dump.
- XEach bit must be 0 or 1.
- XThe 6 bits in the map have the following meanings:
- X.HS
- X.ta 0.25i 0.50i
- X.nf
- X \fIa\fR Display the header record
- X \fIb\fR Display the section records
- X \fIc\fR Display the code bytes
- X \fId\fR Display the relocation records
- X \fIe\fR Display the symbol table records
- X \fIf\fR Display the string area
- X.fi
- X
- X
- X
- X.SP 1.5
- /
- echo x - ar
- sed '/^X/s///' > ar << '/'
- X.CD "ar \(en archiver"
- X.SX "ar\fR [\fBdmpqrtx\fR][\fBabciluv\fR]\fR [\fIposname\fR] \fIarchive \fIfile ..."
- X.FL "\fR(none)"
- X.EX "ar r libc.a sort.s" "Replace \fIsort\fR.s in \fIlibc.a\fR"
- X.EX "ar rb a.s libc.a b.s" "Insert \fIb.s\fR before \fIa.s\fR in \fIlibc.a\fR"
- X.PP
- X\fIAr\fR allows groups of files to be put together into a single archive.
- XIt is normally used for libraries of compiled procedures. The following keys
- Xare allowed:
- X.HS
- X.ta 0.25i 0.50i
- X.nf
- X \fBd\fR: Delete. \fIAr\fR will delete the named members.
- X \fBm\fR: Move named files. \fIAr\fR expects \fIa\fR, \fIb\fR, or \fIi\fR to be specified.
- X \fBp\fR: Print the named files (list them on \fIstdout\fR)
- X \fBq\fR: Quickly append to the end of the archive file.
- X \fBr\fR: Replace (append when not in archive).
- X \fBt\fR: Print the archive's table of contents.
- X \fBx\fR: Extract
- X.fi
- X.HS
- X\fBThe keys may optionally concatencated with one or more of the following\fR:
- X.nf
- X.HS
- X \fBa\fR: After \fIposname\fR
- X \fBb\fR: Before \fIposname\fR
- X \fBc\fR: Create (suppresses creation message)
- X \fBi\fR: Before \fIposname\fR
- X \fBl\fR: Local temporary file for work instead of \fI/tmp/ar.$$$$$\fR
- X \fBu\fR: Replace only if dated later than member in archive
- X \fBv\fR: Verbose
- X.HS
- X.fi
- X
- X
- X
- /
- echo x - as
- sed '/^X/s///' > as << '/'
- X.CD "as \(en MC68000 assembler [68000]"
- X.SX "as [\(ens][\(enu][\(enT\fIdir\fP][\(eno \fIname\fR] \fIfile\fR ..."
- X.FL "\(ens" "Strip symbol table"
- X.FL "\(enu" "Accept undefined symbols as external references"
- X.FL "\(enT" "Make temporary files in \fIdir\fP"
- X.FL "\(eno" "Put output on file named by next arg"
- X.EY "as \(enu \(eno file.o file.s" "assemble file.s into file.o"
- X.PP
- X.I As
- Xaccepts MC68000 instruction in a format like:
- X.I "move.l 4(a0),\(en(sp)" .
- XSee some of the source files, like
- X.I kernel/stmpx.s
- Xand
- X.I lib/sthead.s
- Xto get a feel for the syntax. The assembler supports a variable
- Xnumber of sections, but the combination with the code generator
- Xand linker assume that you start each assembly file by introducing the
- Xfollowing sections:
- X.ta 0.25i 1i
- X.HS
- X .sect .text
- X.br
- X .sect .rom
- X.br
- X .sect .data
- X.br
- X .sect .bss
- X.HS
- XTo get a large sample of code, compile some C programs and inspect the
- Xresulting assembly code.
- XThis will give an idea of what the assembly language looks like.
- X
- X
- X
- /
- echo x - ascii
- sed '/^X/s///' > ascii << '/'
- X.CD "ascii \(en strip all the pure ASCII lines from a file"
- X.SX "ascii\fR [\fB\(enn\fR]\fR [\fIfile\fR]"
- X.FL "\(enn" "Extract the lines containing nonASCII characters"
- X.EX "ascii file >outf" "Write all the ASCII lines on \fIoutf\fR"
- X.EX "ascii \(enn <file >outf" "Write all the nonASCII lines on \fIoutf\fR"
- X.PP
- XSometimes a file contains some nonASCII characters that are in the way.
- XThis program allows the lines containing only ASCII characters to be
- X\fIgrepped\fR from the file.
- XWith the \fB\(enn\fR flag, the nonASCII lines are
- X\fIgrepped\fR.
- XNo matter whether the flag is used or not, the program returns an exit status
- Xof true if the file is pure ASCII, and false otherwise.
- X
- X
- X
- /
- echo x - asize
- sed '/^X/s///' > asize << '/'
- X.CD "asize \(en report the size of an object file [68000]"
- X.SX "asize \fIfile\fR ..."
- X.FL "\fR(none)"
- X.EY "asize test.o" "Give the size of \fItest.o\fR"
- X.PP
- X.I Asize
- Xprints for each argument
- Xthe (decimal) number of bytes used by the different sections,
- Xas well as their sum in decimal and hexadecimal.
- XIf no
- X.I file
- Xis given \fIa.out\fR is used.
- X.I Asize
- Xcan only be used to obtain the size of a \(M2 \fI.o\fR or \fI.out\fR file.
- XTo obtain the size of an executable, use
- X.I size
- Xinstead.
- X
- X
- X
- /
- echo x - asld
- sed '/^X/s///' > asld << '/'
- X.CD "asld \(en assembler-loader [IBM]"
- X.SX "asld\fR [\fB\(enLis\fR]\fR [\fB\(enT \fIdir\fR] [\fB\(eno \fIname\fR] \fIfile\fR ..."
- X.FL "\(enL" "A listing is produced on \fIstdout\fR"
- X.FL "\(enT" "Used to specify a directory for the temporary file"
- X.FL "\(eni" "Use separate I & D space (64K + 64K)"
- X.FL "\(eno" "Output goes to file named by next argument"
- X.FL "\(ens" "A symbol table is produced on \fIstdout\fR"
- X.EX "asld \(ens file.s" "Assemble \fIfile.s and \fP list symbols"
- X.EX "asld \(eno output file.s" "Assemble \fIfile.s\fP, put binary on \fIoutput\fP"
- X.EX "asld \(enT. file1.s file2.s" "Use current directory for temporary file"
- X.PP
- X.I Asld
- Xis the
- X.MX
- Xassembler and loader combined.
- XIt accepts a language similar to that accepted by the \s-2PC-IX\s+2
- Xassembler (see Chap. 9).
- XSymbols are made up of letters, digits and underscores.
- XThe machine instructions and addressing modes are the same as those
- Xused by
- X\s-2PC-IX\s+2, except that modes using multiple registers are written
- Xlike this example:
- X.I "mov ax,(bx_si)."
- XConstant operands are denoted by a sharp sign.
- XLocal labels are permitted in the usual
- X.UX
- Xstyle: the instruction
- X.I "jmp 1f"
- Xjumps forward to the closest label
- X.I 1:
- X.PP
- XThe pseudoinstructions accepted by the assembler are listed below:
- X.HS
- X.ta 0.25i 1.25i
- X.nf
- X \fB.align\fR n \fRAlign to a multiple of \fIn\fP bytes
- X \fB.ascii\fP str \fRAssemble a string
- X \fB.asciz\fP str \fRAssemble a zero-terminated string
- X \fB.bss\fP \fRWhat follows goes in the bss segment
- X \fB.byte\fP n \fRAssemble one or more bytes
- X \fB.data\fP \fRWhat follows goes in the data segment
- X \fB.define\fP sym \fRExport \fIsym\fR from the file
- X \fB.errnz\fP n \fRForce error if \fIn\fP is nonzero
- X \fB.even\fP \fRAlign to an even address
- X \fB.extern\fP sym \fRDeclare \fIsym\fR external
- X \fB.globl\fP sym \fRSame as \fBextern
- X \fB.long\fR n \fRAssemble \fIn\fR as a long
- X \fB.org\fP adr \fRSet address within current segment
- X \fB.short\fP n \fRAssemble \fIn\fR as a short
- X \fB.space\fP n \fRSkip \fIn\fR bytes
- X \fB.text\fP \fRWhat follows goes in the text segment
- X \fB.word\fP n \fRAssemble \fIn\fR as a word
- X \fB.zerow\fP n \fRAssemble \fIn\fP words of zeros
- X.fi
- X.HS
- XIn the above pseudoinstructions,
- X.I adr
- Xis an expression yielding a machine address,
- X.I n
- Xis a numeric expression,
- X.I str
- Xis a quoted string, and
- X.I sym
- Xis a symbol.
- XThe library
- X.DI /usr/lib/libc.a
- Xis a packed archive of assembly code.
- XTo see some examples of it, extract some files from the archive with
- X.I ar
- Xand then use the filter
- X.I libupack
- Xto convert them to readable ASCII.
- X.PP
- XIBM PC
- X.MX
- Xdoes not use
- X.I \&.o
- Xfiles.
- XCompiler output is packed assembly language, as are the modules in an archive.
- XThis scheme requires reassembling archive modules all the time, but it saves
- Xspace.
- XThe 68000 versions use \fI.o\fR files.
- XSee also Chap. 9.
- X
- X
- X
- /
- echo x - ast
- sed '/^X/s///' > ast << '/'
- X.CD "ast \(en add symbol table to executable file [IBM]"
- X.SX "ast\fR [\fB\(enXx\fR]\fR [\fIfile\fR] [\fIsymbol_file\fR]"
- X.FL "\(enX" "Preserve local symbols (except compiler generated ones)"
- X.FL "\(enx" "Do not preserve local symbols"
- X.EY "ast \(enX a.out" "Add symbols from \fIsymbol.out\fR to \fIa.out\fR"
- X.PP
- X\fIAst\fR adds the symbol table produced by the \fB\(ens\fR
- Xoption of asld to the executable file.
- XIf no symbol table file is listed, the default
- Xname \fIsymbol.out\fR is used.
- XThe symbol table can also be directly added to an executed file by the
- Xcommands \fIcc \(ens prog.c\fR.
- X
- X
- X.SP -0.2
- /
- echo x - astrip
- sed '/^X/s///' > astrip << '/'
- X.CD "astrip \(en remove symbols [68000]"
- X.SX "astrip \fIfile\fR ..."
- X.FL "\fR(none)"
- X.EY "astrip kernel.out" "Removes the symbol table from \fIkernel.out\fR"
- X.PP
- X.I Astrip
- Xremoves the symbol table ordinarily attached to
- XACK format object files.
- X.I Astrip
- Xcan only be used to remove the symbol table from a
- X.MX
- X\fI.out\fR file.
- XIt cannot be used to remove symbol tables from executables.
- XTo do that use
- X.I strip
- Xinstead.
- X
- X
- X
- /
- echo x - at
- sed '/^X/s///' > at << '/'
- X.CD "at \(en execute commands at a later time"
- X.SX "at \fItime\fR [\fImonth day\fR] [\fIfile\fR]"
- X.FL "\fR(none)"
- X.EX "at 2315 Jan 31 myfile" "Myfile executed Jan 31 at 11:15 pm"
- X.EX "at 0900" "Job input read from \fIstdin\fR"
- X.EX "at 0711 4 29 " "Read from \fIstdin\fR, exec on April 29"
- X.PP
- X\fIAt\fR prepares a file to be executed later at the specified time by
- Xcreating a special entry in \fI/usr/spool/at\fR.
- XThe program \fIatrun\fR should be started
- Xperiodically, for example, every minute by \fIcron\fR. \fIAtrun\fR
- Xchecks to see if any
- Xfiles in \fI/usr/spool/at\fR should now be run, and if so, it runs them
- Xand then puts them in \fI/usr/spool/at/past\fR.
- XThe name of the file created in \fI/usr/spool/at\fR by
- X\fIat\fR is YY.DDD.HHMM.UU (where YY, DDD, HH, and MM give the time to execute and
- XUU is a unique number). Note that when the command runs, it will not be able
- Xto use \fIstdin\fR or \fIstdout\fR unless specifically redirected. In
- Xthe first example above, it might be necessary to put \fI>/dev/tty0\fR
- Xon some lines in the shell script \fImyfile\fR.
- XThe same holds for the commands typed directly to \fIat\fR.
- X
- X
- X
- /
- echo x - backup
- sed '/^X/s///' > backup << '/'
- X.CD "backup \(en backup files"
- X.SX "backup\fR [\fB\(endjmnorstvz\fR] \fIdir1 dir2"
- X.FL "\(end" "At top level, only directories are backed up"
- X.FL "\(enj" "Do not copy junk: \fI *.Z, *.bak, a.out, core\fR, etc"
- X.FL "\(enm" "If device full, prompt for new diskette"
- X.FL "\(enn" "Do not backup top-level directories"
- X.FL "\(eno" "Do not copy \fI*.o\fR files"
- X.FL "\(enr" "Restore files"
- X.FL "\(ens" "Do not copy \fI*.s\fR files"
- X.FL "\(ent" "Preserve creation times"
- X.FL "\(env" "Verbose; list files being backed up"
- X.FL "\(enz" "Compress the files on the backup medium"
- X.EX "backup \(enmz . /f0" "Backup current directory compressed"
- X.EX "backup /bin /usr/bin" "Backup bin from RAM disk to hard disk"
- X.PP
- X\fIBackup\fR (recursively) backs up the contents of a given directory and its
- Xsubdirectories to another part of the file system.
- XIt has two typical uses.
- XFirst, some portion of the file system can be backed up onto 1 or more
- Xdiskettes.
- XWhen a diskette fills up, the user is prompted for a new one.
- XThe backups are in the form of mountable file systems.
- XSecond, a directory on RAM disk can be backed up onto hard disk.
- XIf the target directory is empty, the entire source directory is copied
- Xthere, optionally compressed to save space.
- XIf the target directory is an old backup, only those files in the target
- Xdirectory that are older than similar names in the source directory are
- Xreplaced.
- X\fIBackup\fR uses times for this purpose, like \fImake\fR.
- XCalling \fIBackup\fR as \fIRestore\fR is equivalent to using the -r option;
- Xthis replaces newer files in the target directory with older files from the
- Xsource directory, uncompressing them if necessary. The target directory
- Xcontents are thus returned to some previous state.
- /
- echo x - badblocks
- sed '/^X/s///' > badblocks << '/'
- X.CD "badblocks \(en put a list of bad blocks in a file"
- X.SX "badblocks \fIblock_special\fR [\fIblock\fR] ..."
- X.FL "\fR(none)"
- X.EX "badblocks /dev/hd1~~~~~~~" "Handle bad blocks on \fI/dev/hd1\fP"
- X.EX "badblocks /dev/hd3 310 570 1680 " "Three bad blocks on \fI/dev/hd3\fP"
- X.PP
- XIf a device contains bad sectors, it is important to not have them
- Xallocated to important files. This program makes it possible to collect
- Xup to 7 bad blocks into a dummy file, so they will not be allocated for a
- X\*(OQreal\*(CQ file.
- XWhen the program starts up, it asks for a list of bad blocks, unless
- Xthey are provided as arguments.
- XThen it creates a file whose name is of the
- Xform \fI.Bad_xxxxx\fR, where \fIxxxxx\fR is a pid.
- X
- X
- X.SP 0.7
- /
- echo x - banner
- sed '/^X/s///' > banner << '/'
- X.CD "banner \(en print a banner"
- X.SX "banner \fIarg ..."
- X.FL "\fR(none)"
- X.EY "banner happy birthday" "Print a banner saying happy birthday"
- X.PP
- X\fIBanner\fR prints its arguments on \fIstdout\fR using a matrix
- Xof 6 x 6 pixels per character. The @ sign is used for the pixels.
- X
- X
- X
- /
- echo x - basename
- sed '/^X/s///' > basename << '/'
- X.CD "basename \(en strip off file prefixes and suffixes"
- X.SX "basename \fIfile\fR [\fIsuffix\fR]
- X.FL "\fR(none)"
- X.EX "basename /user/ast/file.c" "Strips path to yield \fIfile.c\fP"
- X.EX "basename /user/file.c .c" "Strips path and \fI.c\fP to yield \fIfile\fP"
- X.PP
- XThe initial directory names (if any) are removed yielding the name of the
- Xfile itself.
- XIf a second argument is present, it is interpreted as a suffix and is
- Xalso stripped, if present.
- XThis program is primarily used in shell scripts.
- X
- X
- X
- /
- echo x - bawk
- sed '/^X/s///' > bawk << '/'
- X.CD "bawk \(en pattern matching language"
- X.SX "bawk \fIrules\fR [\fIfile\fR] ...
- X.FL "\fR(none)"
- X.EX "bawk rules input" "Process \fIinput\fR according to \fIrules\fR"
- X.EX "bawk rules \(en >out" "Input from terminal, output to \fIout\fR"
- X.PP
- X\fIAwk\fR is a pattern matching language.
- X\fIBawk\fR is Basic Awk, a subset of the original.
- XThe file name \(en can be used to designate \fIstdin\fR.
- XThe manual is given in Chap. 9.
- X
- X
- /
- echo x - btoa
- sed '/^X/s///' > btoa << '/'
- X.CD "btoa \(en binary to ascii conversion"
- X.SX "btoa\fR [\fB\(enadhor\fR]\fR [\fIinfile\fR] [\fIoutfile\fR]"
- X.FL "\(ena" "Decode, rather than encode, the file"
- X.FL "\(end" "Extracts repair file from diagnosis file"
- X.FL "\(enh" "Help menu is displayed giving the options"
- X.FL "\(eno" "The obsolete algorithm is used for backward compatibility"
- X.FL "\(enr" "Repair a damaged file"
- X.EX "btoa <a.out >a.btoa" "Convert \fIa.out\fR to ASCII"
- X.EX "btoa \(ena <a.btoa >a.out" "Reverse the above"
- X.PP
- X\fIBtoa\fR is a filter that converts a binary file to ascii for transmission
- Xover a telephone line. If two file names are provided, the first in used for
- Xinput and the second for output. If only one is provided, it is used as the
- Xinput file. The program is a functionally similar alternative
- Xto \fIuue/uud\fR, but the encoding is completely different.
- XSince both of these are widely used, both have been provided with
- X.MX .
- XThe file is expanded about 25 percent in the process.
- X
- X
- X
- /
- echo x - cal
- sed '/^X/s///' > cal << '/'
- X.CD "cal \(en print a calendar"
- X.SX "cal\fR [\fImonth\fR] \fIyear"
- X.FL "\fR(none)"
- X.EY "cal 3 1992" "Print March 1992"
- X.PP
- X\fICal\fR prints a calendar for a month or year. The year can be
- Xbetween 1 and 9999.
- XNote that the year 91 is not a synonym for 1991, but is itself a
- Xvalid year about 19 centuries ago. The calendar produced is the one used
- Xby England and her colonies. Try Sept. 1752, Feb 1900, and Feb 2000. If
- Xyou do not understand what is going on, look up \fICalendar, Gregorian\fR in a
- Xgood encyclopedia.
- X
- X
- X.SP 2.5
- /
- echo x - calendar
- sed '/^X/s///' > calendar << '/'
- X.CD "calendar \(en reminder service"
- X.SX "calendar [\fB\(en\fR] [\fB\(enr\fR]"
- X.FL "\(en" "Work for every user and send mail to him"
- X.FL "\(enr" "Restrict multiple execution on the same day"
- X.EX "calendar" "Check \fIcalendar\fR file in current directory"
- X.EX "calendar" "Normary used under the control of cron(8)"
- X.EX "calendar \(enr" " Normary used in /etc/rc file"
- X.PP
- XBasically \fIcalendar\fR program consults the file \fIcalendar\fR in the
- Xcurrent directory and display lines which contain today's or tomorrow's date.
- XMonth-day formats such as '12/25', 'Dec. 25',
- X'december 25', '*/25', '12/*', '*/*' are recognized. The asterisk
- Xmeans 'all' days or 'all' months. On weekends 'tomorrow' extends through
- Xnext Monday without any consideration about holidays.
- XTo prevent ambiguity, the formats '25 Dec.' and '25/12' are not recognized.
- X.PP
- XWhen an argument \fB\(en\fR is present, \fIcalendar\fR works for all users
- Xwith a file \fIcalendar\fR in their login directories and sends them mail.
- XNormally this is done daily under the control of \fIcron\fR.
- X.PP
- XThe \fB\(enr\fR option does its the same job as \fB\(en\fR option, but touches
- Xthe \fIcalendar\fR to prevents further access on the same day.
- XNormally this is done in the \fI/etc/rc\fR file on a machine which may be
- Xbooted several times in one day.
- /
- echo x - cat
- sed '/^X/s///' > cat << '/'
- X.CD "cat \(en concatenate files and write them to \fIstdout\fP"
- X.SX "cat\fR [\fB\(enu\fR]\fR [\fIfile\fR] ..."
- X.FL "\(enu" "Unbuffered output"
- X.EX "cat file" "Display file on the terminal"
- X.EX "cat file1 file2 | lpr" "Concatenate 2 files and print result"
- X.PP
- X.I Cat
- Xconcatenates its input files and copies the result to \fIstdout\fR.
- XIf no input file is named, or \(en is encountered as a file name, standard
- Xinput is used.
- XOutput is buffered in 512 byte blocks unless the
- X.B \(enu
- Xflag is given.
- XIf you just want to copy a file, \fIcp\fR should be used since it is faster.
- X.SP 2.5
- X
- X
- /
- echo x - cc
- sed '/^X/s///' > cc << '/'
- X.CD "cc \(en C compiler"
- X.SX "cc\fR [\fB\(enFLRSTUciosvw\fR]\fR [\fB\(enD\fIname\fR] ... [\fB\(enI\fIdir\fR] ... [\fB\(enLIB\fR] \fIfile\fR ..."
- X.FL "\(enD" "The flag \fB\(enD\fIx=y\fR defines a macro \fIx\fR with (optional) value \fIy\fR"
- X.FL "\(enF" "Use a file instead of a pipe for preprocessor output [IBM]"
- X.FL "\(enI" "\fB\(enI\fIdir\fR searches \fIdir\fP for include files"
- X.FL "\(enL" "List the assembly code on \fIstdout\fR [IBM]"
- X.FL "\(enLIB~\fRProduce a library module [IBM]" ""
- X.FL "\(enR" "Complain about all non Kernighan & Ritchie code"
- X.FL "\(enS" "Produce an assembly code file, then stop"
- X.FL "\(enT" "The flag \fB\(enT\fIdir\fR tells \fIcem\fR to use \fIdir\fR for temporary files"
- X.FL "\(enU" "Undefine a macro"
- X.FL "\(enc" "Compile only. Do not link.
- X.FL "\(eni" "Use separate I & D space (64K + 64K) [IBM]"
- X.FL "\(eno" "Put output on file named by next arg"
- X.FL "\(ens" "For IBM, add symbol table; for 68000 strip symbol table"
- X.FL "\(env" "Verbose; print pass names"
- X.FL "\(enw" "Suppress warning messages"
- X.EX "cc \(enc file.c" "Compile \fIfile.c\fP"
- X.EX "cc \(enD_MINIX file.c" "Treat the symbol \fI_MINIX\fP as defined"
- X.EX "cc \(enc \(enLIB file.c" "Make a module for the library"
- X.PP
- XThis is the C compiler.
- XIt has multiple passes.
- XThe names of the programs executed for each pass, their inputs and their
- Xoutputs are given in the table below.
- X.HS
- X.ta 1.4i 2.1i 2.8i 3.5
- X \fBProgram Input Output Operation performed\fR
- X.br
- X /lib/cpp prog.c prog.i C preprocessor [IBM]
- X.br
- X /lib/cem prog.i prog.k Parsing and semantic analysis
- X.br
- X /usr/lib/opt prog.k prog.m Optimization of the intermediate code
- X.br
- X /usr/lib/cg prog.m prog.s Code generation
- X.br
- X /usr/bin/asld prog.s a.out Assembly and linking [IBM]
- X.br
- X /usr/bin/as prog.s prog.o Assembly [68000]
- X.br
- X /usr/lib/ld prog.o .out Linking [68000]
- X.br
- X /usr/lib/cv .out a.out Conversion to \s-2MINIX\s0 format [68000]
- X.HS
- XThe main program,
- X.I cc ,
- Xforks appropriately to call the passes, transmitting flags and arguments.
- XThe \fB\(env\fR flag causes the passes to be listed as they are called.
- X.PP
- XThe IBM C compiler uses a combined assembler-linker that takes in assembly
- Xcode files in packed format and produces an \fIa.out\fR file.
- XThe 68000 C compiler uses normal \fI.o\fR files.
- XAssembly language files on the IBM can be packed and unpacked using the
- Xfilters \fIlibpack\fR and \fIlibupack\fR.
- XThe IBM libraries are
- Xarchives of packed assembly code files, except that defined symbols
- Xmust be declared by \fI.define\fP statements at the beginning.
- XTo make modules for inclusion in the library, use the \fB\(enc\fP and
- X\fB\(enLIB\fP options.
- XIf you compile library modules by accident without using the \fB\(enLIB\fR
- Xflag, they will not be recognized, leading to undefined reference error
- Xmessages from the linker.
- X.PP
- XIf memory is tight, use the \fB\(enF\fR flag to force the compiler to
- Xrun the passes one at a time, without pipes.
- XWhen available memory is very limited, it may be
- Xnecessary to run
- X.I chmem
- Xto reduce the sizes of some compiler passes.
- XOn the other hand,
- Xif the compiler (or, in fact, almost any program)
- Xbegins acting strange, it is almost always due to its running
- Xout of stack or disk space.
- XThe relevant pass can be given more stack space using
- X.I chmem .
- XFor large programs, it make take a little experimenting to get the sizes
- Xright.
- XThe \fIcem\fR is usually the guilty party.
- XBe careful about \fI/tmp\fR filling up too.
- XMore space for scratch files can be obtained by removing other files
- Xof using \fB\(enT\fR.
- X.PP
- XThe compiler is derived from the ACK system (Tanenbaum et
- Xal., \fICommunications of the ACM\fR, Sept. 1983),
- Xnot from the AT&T portable C compiler.
- XThe sources are available from the companies listed after the Table of
- XContents.
- X
- X
- X
- /
- echo x - cdiff
- sed '/^X/s///' > cdiff << '/'
- X.CD "cdiff \(en context diff"
- X.SX "cdiff\fR [\fB\(enc\fIn\fR] \fIoldfile \fInewfile"
- X.FL "\(enc" "Provide \fIn\fR lines of context"
- X.EX "cdiff old new >f" "Write context diff on \fIf\fR"
- X.EX "cdiff \(enc1 old new >f" "Use only 1 line of context"
- X.PP
- X\fICdiff\fR produces a context diff by first running \fIdiff\fR and then
- Xadding context.
- XSome update programs, like \fIpatch\fR, can use context diffs to update
- Xfiles, even in the presence of other, independent changes.
- X
- X
- X
- /
- echo x - cgrep
- sed '/^X/s///' > cgrep << '/'
- X.CD "cgrep \(en grep and display context"
- X.SX "cgrep\fR [\fB\(ena \fIn\fR]\fR [\fB\(enb \fIn\fR] [\fB\(enf\fR] [\fB\(enl \fIn\fR] [\fB\(enn\fR] [\fB\(enw \fIn\fR] \fIpattern\fR [\fIfile\fR] ...
- X.FL "\(ena" "How many lines to display after the matching line"
- X.FL "\(enb" "How many lines to display before the matching line"
- X.FL "\(enf" "Suppress file name in the output"
- X.FL "\(enl" "Lines are truncated to this length before comparison"
- X.FL "\(enn" "Suppress line numbers in the output"
- X.FL "\(enw" "Sets window size (same as \fB\(ena\fR n \fB\(enb\fR n)"
- X.EY "cgrep \(enw 3 hello file1" "Print 3 lines of context each way"
- X.PP
- X\fICgrep\fR is a program like \fIgrep\fR, except that it also can print
- Xa few lines above and/or below the matching lines.
- XIt also prints the line numbers of the output.
- X
- X
- X
- /
- echo x - chgrp
- sed '/^X/s///' > chgrp << '/'
- X############ NEXT ENTRY HAS NOT BEEN CHECKED #############
- X.CD "chgrp \(en change group"
- X.SX "chgrp [\fB\(enR\fR] [\fIuser.\fR]\fIgroup \fIfile\fR ..."
- X.FL "\(enR" "Change directory hierarchies"
- X.EX "chgrp system file1 file2" "Make \fIsystem\fR the group of the files"
- X.EX "chrgp \(enR other dir1" "Make \fIother\R the group of all files below dir1"
- X.PP
- XThe group field (and optionally user field) of the named files is changed to
- X.I group
- Xand
- X.I user .
- XAlternatively, a decimal gid (uid) may be specified instead of a group name.
- XIf the \fB\(enR\fR flag is used, the changes will be applied recursively to
- Xall files in named directories. Only the superuser may execute this command.
- X
- X
- X
- /
- echo x - chmem
- sed '/^X/s///' > chmem << '/'
- X.CD "chmem \(en change memory allocation"
- X.SX "chmem\fR [\fB+\fR]\fR [\fB\(en\fR] [\fB=\fR] \fIamount file
- X.FL "\fR(none)"
- X.EX "chmem =50000 a.out" "Give \fIa.out\fP 50K of stack space"
- X.EX "chmem \(en4000 a.out" "Reduce the stack space by 4000 bytes"
- X.EX "chmem +1000 file1" "Increase each stack by 1000 bytes"
- X.PP
- XWhen a program is loaded into memory, it is allocated enough memory
- Xfor the text and data+bss segments, plus
- Xan area for the stack.
- XData segment growth using
- X.I malloc ,
- X.I brk ,
- Xor
- X.I sbrk
- Xeats up stack space from the low end.
- XThe amount of stack space to allocate is derived
- Xfrom a field in the executable program's file header.
- XIf the combined stack and data segment growth exceeds the stack space
- Xallocated, the program will be terminated.
- X.PP
- XIt is therefore important to set the amount of stack space carefully.
- XIf too little is provided, the program may crash.
- XIf too much is provided, memory will be wasted, and fewer programs will be able
- Xto fit in memory and run simultaneously.
- X.MX
- Xdoes not swap, so that when memory is full, subsequent attempts to fork will
- Xfail.
- XThe compiler sets the stack space
- Xto the largest possible value (for the Intel CPUs, 64K \(en text \(en data).
- XFor many programs, this value is far too large.
- XNonrecursive programs that do not call
- X.I brk ,
- X.I sbrk ,
- Xor
- X.I malloc ,
- Xand do not have any local arrays usually do not need more than 8K of stack
- Xspace.
- X.PP
- XThe
- X.I chmem
- Xcommand changes the value of the header field that determines the stack allocation, and
- Xthus indirectly the total memory required to run the program.
- XThe = option sets the stack size
- Xto a specific value; the + and \(en options increment and decrement the
- Xcurrent value by the indicated amount.
- XThe old and new stack sizes are printed.
- X
- X
- X
- /
- echo x - chmod
- sed '/^X/s///' > chmod << '/'
- X############ NEXT ENTRY HAS NOT BEEN CHECKED #############
- X.CD "chmod \(en change access mode for files"
- X.SX "chmod [\fB\(enR\fR] \fImode \fIfile\fR ..."
- X.FL "\(enR" "Change hierarchies recursively"
- X.EX "chmod 755 file" "Owner: rwx Group: r\(enx Others: r\(enx"
- X.EX "chmod +x file1 file2" "Make \fIfile1\fR and \fIfile2\fR executable"
- X.EX "chmod a\(enw file" "Make \fIfile\fR read only"
- X.EX "chmod u+s file" "Turn on SETUID for \fIfile\fR"
- X.EX "chmod \(enR o+w dir" "Allow writing for all files in dir"
- X.PP
- XThe given mode is applied to each file in the file list. If the \fB\(enR\fR
- Xflag is present, the files in a directory will be changed as well.
- XThe mode can be either absolute or symbolic. Absolute modes are given as an
- Xoctal number that represents the new file mode. The mode bits are defined as
- Xfollows:
- X.ta 0.25i
- X.nf
- X.HS
- X 4000 Set effective user id on execution to file's owner id
- X 2000 Set effective group id on execution to file's group id
- X 0400 file is readable by the owner of the file
- X 0200 writeable by owner
- X 0100 executable by owner
- X 0070 same as above, for other users in the same group
- X 0007 same as above, for all other users
- X.HS
- X.fi
- XSymbolic modes modify the current file mode in a specified way. The form is:
- X.HS
- X [who] op permissions { op permissions ...} {, [who] op ... }
- X.HS
- XThe possibilities for \fIwho\fR are \fIu\fR, \fIg\fR, \fIo\fR, and \fIa\fR,
- Xstanding for user, group, other and all, respectively.
- XIf \fIwho\fR is omitted, \fIa\fR is assumed, but the current umask is used.
- XThe op can be \fI+\fR, \fI-\fR, or \fI=\fR; \fI+\fR turns on the
- Xgiven permissions, \fI\(en \fRturns them off; \fI=\fR sets the permissions
- Xexclusively for the given \fIwho\fR.
- XFor example \fIg=x\fR sets the group permissions to \fI--x\fR.
- X.PP
- XThe possible permissions are \fIr\fR, \fIw\fR, \fIx\fR; which stand for read,
- Xwrite, and execute; \fIs\fR turns on the set effective user/group id bits.
- X\fIs\fR only makes sense with \fIu\fR and \fIg\fR;\fR o+s\fR is
- Xharmless.
- X
- X
- X
- /
- echo x - chown
- sed '/^X/s///' > chown << '/'
- X############ NEXT ENTRY HAS NOT BEEN CHECKED #############
- X.CD "chown \(en change owner"
- X.SX "chown [\fB\(enR\fR] \fIuser\fR[.\fIgroup\fR] \fIfile\fR ..."
- X.FL "\(enR" "Change directory hierarchies"
- X.EX "chown ast file1 file2" "Make \fIast\fR the owner of the files"
- X.EX "chown \(enR ast.other dir" "Change the owner and group of all files in dir"
- X.PP
- XThe owner field (and optionally group field) of the named files is changed
- Xto
- X.I user
- X(i.e., login name specified) and
- X.I group .
- XAlternatively, a decimal uid(gid) may be specified instead of a user name.
- XOnly the superuser may execute this command.
- X
- X
- X
- /
- echo x - cksum
- sed '/^X/s///' > cksum << '/'
- X############ NEXT ENTRY HAS NOT BEEN CHECKED #############
- X.CD "cksum \(en display file checksum and size"
- X.SX "cksum [\fIfile\fR ...]"
- X.FL "\fR(none)"
- X.EX "cksum" "Display CRC and size of \fIstdin\fR"
- X.EX "cksum *.c" "Display CRC and size of \fI.c\fP files"
- X.PP
- X.I Cksum
- Xcalculates and writes to standard output the 32-bits CRC of the input
- X.I files ,
- Xor of stdin if no
- X.I files
- Xwere specified. The size in bytes of each
- X.I file
- Xwill be displayed after a space. The name of each
- X.I file
- Xwill be displayed after another space.
- X
- X
- X
- X
- /
- echo x - clr
- sed '/^X/s///' > clr << '/'
- X.CD "clr \(en clear the screen"
- X.SX "clr~~~~~~~~"
- X.FL "\fR(none)"
- X.EY "clr ~" "Clear the screen"
- X.PP
- XAll text is removed from the screen, resulting in an empty screen with the
- Xcursor positioned in the upper left-hand corner.
- X
- X
- X
- X.SP 1.7
- /
- echo x - cmp
- sed '/^X/s///' > cmp << '/'
- X.CD "cmp \(en compare two files"
- X.SX "cmp\fR [\fB\(enls\fR] \fIfile1 file2"
- X.FL "\(enl" "Loud mode. Print bytes that differ (in octal)"
- X.FL "\(ens" "Silent mode. Print nothing, just return exit status"
- X.EX "cmp file1 file2" "Tell whether the files are the same"
- X.EX "cmp \(enl file1 file2" "Print all corresponding bytes that differ"
- X.PP
- XTwo files are compared.
- XIf they are identical, exit status 0 is returned.
- XIf they differ, exit status 1 is returned.
- XIf the files cannot be opened, exit status 2 is returned.
- XIf
- X.I file1
- Xis \(en ,
- X\fIstdin\fR is compared to
- X.I file2 .
- X
- X
- X
- /
- echo x - comm
- sed '/^X/s///' > comm << '/'
- X.CD "comm \(en print lines common to two sorted files"
- X.SX "comm\fR [\fB\(en123\fR] \fIfile1 file2
- X.FL "\(en1" "Suppress column 1 (lines present only in \fIfile1\fP)"
- X.FL "\(en2" "Suppress column 2 (lines present only in \fIfile2\fP)"
- X.FL "\(en3" "Suppress column 3 (lines present in both files)"
- X.EX "comm file1 file2" "Print all three columns"
- X.EX "comm \(en12 file1 file2" "Print only lines common to both files"
- X.PP
- XTwo sorted files are read and compared.
- XA three column listing is produced.
- XFiles only in
- X.I file1
- Xare in column 1;
- Xfiles only in
- X.I file2
- Xare in column 2;
- Xfiles common to both files are in column 3.
- XThe file name \(en means \fIstdin\fR.
- X
- X
- X
- X.SP 1.5
- /
- echo x - compress
- sed '/^X/s///' > compress << '/'
- X.CD "compress \(en compress a file using modified Lempel-Ziv coding"
- X.SX "compress\fR [\fB\(encdfv\fR]\fR [\fIfile\fR] ..."
- X.FL "\(enc" "Put output on \fIstdout\fR instead of on \fIfile.Z\fR"
- X.FL "\(end" "Decompress instead of compress"
- X.FL "\(enf" "Force output even if there is no saving"
- X.FL "\(env" "Verbose mode"
- X.EX "compress <infile >outfile" "Compress 1 file"
- X.EX "compress x y z" "Compress 3 files to \fIx.Z\fR, \fIy.Z\fR, and \fIz.Z\fR"
- X.EX "compress \(end file.Z" "Decompress \fIfile.Z\fR to \fIfile\fR"
- X.PP
- XThe listed files (or \fIstdin\fR, if none are given) are compressed
- Xusing the Ziv-Lempel algorithm. If the output is smaller than the input,
- Xthe output is put on \fIfile.Z\fR or \fIstdout\fR if no files are listed.
- XIf \fIcompress\fR is linked to \fIuncompress\fR, the latter is the same
- Xas giving the \fB\(end\fP flag.
- XSimilarly, a link to \fIzcat\fR decompresses to \fIstdout\fR.
- XThe
- X.MX
- Xversion of \fIcompress\fR uses 13-bit compression.
- XThis means that when compressing files on other systems for transmission to
- X.MX ,
- Xbe sure that only 13-bit compression is used.
- XOn many systems, the default is 16-bit (too big).
- X
- X
- X.SP 1.5
- /
- echo x - cp
- sed '/^X/s///' > cp << '/'
- X############ NEXT ENTRY HAS NOT BEEN CHECKED #############
- X.CD "cp \(en file copy"
- X.SX "cp [\fB\(enRf\&iprv\fR] \fIfile1\fR \fIfile2\fR"
- X.SX "cp [\fB\(enfR\&iprv\fR] \fIfile\fR ... \fIdirectory\fR"
- X.FL "\(enf" "Forced remove existing file"
- X.FL "\(eni" "Ask before removing existing file"
- X.FL "\(enp" "Preserver full mode, uid, gid and times"
- X.FL "\(enr" "Copy directories and treat special files as ordinary"
- X.FL "\(env" "Display what cp is doing"
- X.FL "\(enR" "Copy directories"
- X.EX "cp oldfile newfile" "Copy \fIoldfile\fR to \fInewfile\fR"
- X.EX "cp -R special newspecial" "Copy the \fIspecial\fR file"
- X.PP
- X.I Cp
- Xcopies one file to another, or copies one or more files to a directory.
- XUnless the \fB\(enr\fR flag is specified, special files will be copied as
- Xspecial files. Copying a directory requires either the \fB\(enr\fR or the
- X\fB\(enR\fR flags.
- X
- X
- X
- X
- /
- echo x - cpdir
- sed '/^X/s///' > cpdir << '/'
- X############ NEXT ENTRY HAS NOT BEEN CHECKED #############
- X.CD "cpdir \(en copy a directory and its subdirectories"
- X.SX "cpdir [\fB\(enpv\fR] \fIsrcdir\fR \fIdstdir\fR"
- X.FL "\(enp" "Preserve the full mode, uid, gid and times"
- X.FL "\(env" "Display cpdir's actions"
- X.EY "cpdir dir1 dir2" "create \fIdir2\fR and copy \fIdir1\fR's files in it"
- X.PP
- X.I Cpdir
- Xis identical to \fIcp \(enR\fR command, except that the destination directory
- Xis allowed to exists before the copy. Also, unlike
- X.I cp ,
- X.I cpdir
- Xwill preserve the link structure of the copied directory.
- X
- X
- X
- X
- /
- echo x - crc
- sed '/^X/s///' > crc << '/'
- X.CD "crc \(en print the checksum of the file data"
- X.SX "crc \fIfile\fR ..."
- X.FL "\fR(none)\fR"
- X.EY "crc *.c" "Print checksums of all the C programs"
- X.PP
- XThe checksum of each argument is computed and printed, along with the file
- Xlength and its name, one file per line.
- XThis program is useful for seeing if a file transmitted to another machine
- Xhas arrived correctly.
- XIt is conceptually similar to \fIsum\fR, except that it uses a stronger
- Xchecksum algorithm and also prints the length.
- X
- X
- X
- X.SP 1
- /
- echo x - cron
- sed '/^X/s///' > cron << '/'
- X.CD "cron \(en clock daemon"
- X.SX "cron"
- X.FL "\fR(none)"
- X.EY "/usr/bin/cron" "Use absolute path in \fI/etc/rc\fR"
- X.PP
- X\fICron\fR is clock daemon. It is typically started up by including the
- Xcommand \fI/usr/bin/cron\fR in the \fI/etc/rc\fR file.
- XOnce started, \fIcron\fR puts itself
- Xin the background, so no & is needed. It runs forever, sleeping most of
- Xthe time. Once a minute it wakes up and examines \fI/usr/lib/crontab\fR to see
- Xif there is any work to do. If there is, the work is done. The entries of
- X\fI/usr/lib/crontab\fR contain 6 elements each. Some examples follow:
- X.HS
- X.nf
- X.ta 0.10i 0.40i 0.70i 1.0i 1.3i 1.8i 4.0i
- X\fB Min Hr Dat Mo Day Command\fR
- X \0* \0* \0* \0* \0* /usr/bin/date >/dev/tty0 #print date every minute
- X \00 \0* \0* \0* \0* /usr/bin/date >/dev/tty0 #print date on the hour
- X 30 \04 \0* \0* 1-5 /bin/backup /dev/fd1 #do backup Mon-Fri at 0430
- X 30 19 \0* \0* 1,3,5 /etc/backup /dev/fd1 #Mon, Wed, Fri at 1930
- X \00 \09 25 12 \0* /usr/bin/sing >/dev/tty0 #Xmas morning at 0900 only
- X.fi
- X
- X
- X
- X
- /
- echo x - ctags
- sed '/^X/s///' > ctags << '/'
- X.CD "ctags \(en build a tags file"
- X.SX "ctags \fR[\fB\(enr\fR]\fR \fIfile\fR ..."
- X.FL "\(enr" "Generate refs as well as tags"
- X.EY "ctags \(enr *.h *.c" "Generate the tags file"
- X.PP
- X\fICtags\fR generates a \fItags\fR file from a collection of
- XC source files. It can also generate a \fIrefs\fR file.
- XThe \fItags\fR file is used by \fIelvis'\fR
- X\*(OQ:tag\*(CQ command, and its \fB\(ent\fR
- Xoption.
- XEach C source file is scanned for \fI#define\fR statements and global
- Xfunction definitions. The name of the macro or function becomes the name of
- Xa tag. For each tag, a line is added to the \fItags\fR file which contains:
- Xthe name of the tag, a tab character, the name of the file containing the tag,
- Xa tab character, and a way to find the particular line within the file.
- X.PP
- XThe \fIrefs\fR file is used by the \fIref\fR program, which can be invoked
- Xvia \fIelvis\fR K command. When ctags finds a global function definition, it
- Xcopies the function header into the \fIrefs\fR file.
- XThe first line is flush against the
- Xright margin, but the argument definitions are indented.the C source files.
- X
- X
- X
- X.SP -0.5
- /
- echo x - cut
- sed '/^X/s///' > cut << '/'
- X.CD "cut \(en select out columns of a file"
- X.SX "cut [ \fB \(enb \fR|\fB \(enc\fR] \fIlist\fR [\fIfile...\fR]"
- X.SX "cut \(enf \fIlist\fR [\fB\(end \fIdelim\fR] [\fB \(ens\fR]
- X[\fIfile...\fR]"
- X.FL "\(enb" "Cut specified bytes"
- X.FL "\(enc" "Select out specific characters"
- X.FL "\(end" "Change the column delimiter to \fIdelim\fR"
- X.FL "\(enf" "Select out specific fields that are separated by the
- Xdelimiter character ( see \fIdelim\fR)"
- X.FL "\(eni" "Runs of delimiters count as one"
- X.FL "\(ens" "Suppres lines with no delimiter characters, when used
- Xwith the \(enf option. Lines with no delimiters are passwd through
- Xuntouched"
- X.EX "cut \(enf 2 file" "Extract field 2"
- X.EX "cut \(enc 1\(en2,5 file" "Extract character columns 1, 2, and 5"
- X.EX "cut \(enc 1\(en5,7\(en file" "Extract all columns except 6"
- X.PP
- X\fICut\fR extracts one or more fields or columns from a file and writes them on
- Xstandard output.
- XIf the \fB\(enf\fR flag is used, the fields are separated by a delimiter
- Xcharacter, normally a tab, but can be changed using the \fB\(end\fR flag.
- XIf the \fB\(enc\fR flag is used, specific columns can be specified.
- XThe list can be comma or BLANK separated. The \fB\(enf\fR and
- X\fB\(enc\fR flags are mutually exclusive.
- XNote: The POSIX1003.2 standard requires the option \(enb to cut out
- Xspecific bytes in a file. It is intended for systems with multi byte
- Xcharacters (e.g. kanji), since MINIX uses only one byte characters,
- Xthis option is equivalent to \(enc. For the same reason, the option
- X\(enn has no effect and is not listed in this manual page.
- X
- X
- X
- X
- /
- echo x - date
- sed '/^X/s///' > date << '/'
- X############ NEXT ENTRY HAS NOT BEEN CHECKED #############
- X.CD "date \(en print or set the date and time"
- X.SX "date [\fB\(enq\fR] [[\fIMMDDYY\fR]\fIhhmm\fR[\fIss\fR]\fR]"
- X.SX "date [\fB\(enu\fR] [\fI+format\fR]
- X.FL "\(enq" "Read the date from \fIstdin\fR"
- X.FL "\(enu" "Print the date as GMT"
- X.EX "date" "Print the date and time"
- X.EX "date 0221921610" "Set date to Feb 21, 1992 at 4:10 p.m."
- X.PP
- XWith the \fB\(enq\fR flag or a numeric argument,
- X.I date
- Xsets the GMT time and date.
- X.I MMDDYY
- Xrefers to the month, day, and year;
- X.I hhmmss
- Xrefers to the hour, minute and second.
- XEach of the six fields must be exactly two digits, no more and no less.
- X.I date
- Xalways display the date and time, with the default format for the system.
- XThe \fB\(enu\fR flag request GMT time instead of local time.
- XA format may be specified with a + followed by a printf-like string with
- Xthe following options:
- X.ta 0.25i
- X.nf
- X.HS
- X %% % character
- X %A Name of the day
- X %B Name of the month
- X %D mm/dd/yy
- X %H Decimal hour on 2 digits
- X %I Decimal hour modulo 12 on 2 digits
- X %M Decimal minute on 2 digits
- X %S Decimal seconds on 2 digits
- X %T HH:MM:SS
- X %U Decimal week number, Sunday being first day of week
- X %W Decimal week number, Monday being first day of week
- X %X Same as %T
- X %Y Decimal year on 4 digits
- X %Z Time Zone (if any)
- X %a Abbreviated name of the day
- X %b Abbreviated name of the month
- X %c Appropriate date & time (default format)
- X %d Decimal day of the month on 2 digits
- X %e Same as %d, but a space replaces leading 0
- X %h Same as %b
- X %j Decimal dey of the year on 3 digits
- X %m Decimal month on 2 digits
- X %n Newline character
- X %p AM or PM
- X %r 12-hour clock time with AM/PM
- X %t Tab character
- X %w Decimal day of the week (0=Sunday)
- X %x Same as %D
- X %y Decimal year on 2 digits
- X.HS
- X
- X
- X
- /
- echo x - dd
- sed '/^X/s///' > dd << '/'
- X.CD "dd \(en disk dumper"
- X.SX "dd\fR [\fIoption = value\fR] ..."
- X.FL "\fR(none)"
- X.EX "dd if=/dev/fd0 of=/dev/fd1" "Copy disk 0 to disk 1"
- X.EX "dd if=x of=y bs=1w skip=4" "Copy \fIx\fP to \fIy\fP, skipping 4 words"
- X.EX "dd if=x of=y count=3" "Copy three 512\(enbyte blocks"
- X.PP
- XThis command is intended for copying partial files.
- XThe block size, skip count, and number of blocks to copy can be specified.
- XThe options are:
- X.HS
- X.ta 0.25i 1.5i
- X \fBif\fR = file \(en Input file (default is \fIstdin\fR)
- X.br
- X \fBof\fR = file \(en Output file (default is standard output)
- X.br
- X \fBibs\fR = n \(en Input block size (default 512 bytes)
- X.br
- X \fBobs\fR = n \(en Output block size (default is 512 bytes)
- X.br
- X \fBbs\fR = n \(en Block size; sets \fIibs\fP and \fIobs\fP (default is 512 bytes)
- X.br
- X \fBskip\fR = n \(en Skip \fIn\fP input blocks before reading
- X.br
- X \fBseek\fR = n \(en Skip \fIn\fP output blocks before writing
- X.br
- X \fBcount\fR = n \(en Copy only \fIn\fP input blocks
- X.br
- X \fBconv = lcase\fR \(en Convert upper case letters to lower case
- X.br
- X \fBconv = ucase\fR \(en Convert lower case letters to upper case
- X.br
- X \fBconv = swab\fR \(en Swap every pair of bytes
- X.br
- X \fBconv = noerror\fR \(en Ignore errors and just keep going
- X.HS
- XWhere sizes are expected, they are in bytes.
- XHowever, the letters \fBw\fR, \fBb\fR, or \fBk\fR may be appended to the
- Xnumber to indicate words (2 bytes), blocks (512 bytes), or K
- X(1024 bytes), respectively.
- XWhen
- X.I dd
- Xis finished, it reports the number of full and partial blocks read and written.
- X
- X
- X
- X.SP 1
- /
- echo x - de
- sed '/^X/s///' > de << '/'
- X.CD "de \(en disk editor"
- X.SX "de\fR [\fB\(enw\fR] \fIblock_device"
- X.SX "de \(enr \fIfile
- X.FL "\(enr" "Recover a file that has been removed"
- X.FL "\(enw" "Enable writing, so device can be modified"
- X.EX "de \(enr /usr/ast/prog.c" "Undo the effects of: \fIrm /usr/ast/prog.c\fR"
- X.EX "de \(enw /dev/fd0" "Edit \fI/dev/fd0\fR for writing"
- X.PP
- X\fIDe\fR is a program for system administrators that allows disks to be
- Xinspected block by block.
- XA variety of display options and commands are available, as described in
- XChap. 9.
- XFor a summary, start the program and type \fIh\fR for help.
- XThe program can also restore files that have just been removed by \fIrm\fR,
- Xprovided that the i-node and blocks are still intact.
- XAnother feature is searching disks for ASCII strings, to help locate things
- Xafter a crash.
- XFinally, individual disk words can be changed, for example, the sizes of
- Xblock special files.
- X
- X
- X
- /
- echo x - df
- sed '/^X/s///' > df << '/'
- X.CD "df \(en report on free disk space and i-nodes"
- X.SX "df \fIspecial ..."
- X.FL "\fR(none)"
- X.EX "df /dev/ram" "Report on free RAM disk space"
- X.EX "df /dev/fd0 /dev/fd1" "Report on diskette space"
- X.EX "df~~~" "Report on all mounted devices"
- X.PP
- XThe amount of disk space and number of i-nodes, both free and used is
- Xreported.
- XIf no argument is given, \fIdf\fR reports on the root device and all mounted
- Xfile systems.
- X
- X
- X
- /
- echo x - dhrystone
- sed '/^X/s///' > dhrystone << '/'
- X.CD "dhrystone \(en integer benchmark"
- X.SX "dhrystone"
- X.FL "\fR(none)"
- X.EY "dhrystone" "Run the dhrystone benchmark"
- X.PP
- XMany years ago, a floating-point benchmark called \fIwhetstone\fR was
- Xpopular for benchmarking FORTRAN programs.
- XNowadays, an integer benchmark called \fIdhrystone\fR is widely used
- Xfor benchmarking UNIX systems.
- XThis is it.
- XBe warned, however, that \fIdhrystone\fR is entirely CPU bound, and
- Xgoes blindingly fast on machines with high-speed caches.
- XAlthough this is a good measure for programs that spend most of their
- Xtime in some inner loop, it is a poor benchmark for I/O bound applications.
- X
- X
- X
- /
- echo x - diff
- sed '/^X/s///' > diff << '/'
- X.CD "diff \(en print differences between two files"
- X.SX "diff \fR [\fB\(enc \fR|\fB \(ene \fR|\fB \(enC \fIn\fR\] [\fB\(enbr\fR]\fIfile1 file2\fR"
- X.FL "\(enC \In" "Produce output that contains \fIn\fR lines of context"
- X.FL "\(enb" "Ignore white space when comparing"
- X.FL "\(enc" "Produce output that contains three lines of context"
- X.FL "\(ene" "Produce an \fIed\fR-script to convert \fIfile1\fR into \fIfile2\fR"
- X.FL "\(enr" "Apply \fIdiff\fR recursively to files and directories of
- Xthe same name, when \fIfile1\fR and \fIfile2\fR are both directories"
- X.EX "diff file1 file2" "Print differences between 2 files"
- X.EX "diff -C 0 file1 file2" "Same as above"
- X.EX "diff -C 3 file1 file2" "Output three lines of context with every
- Xdifference encountered"
- X.EX "diff -c file1 file2" Same as above"
- X.EX "diff /etc /dev" "Compares recursively the directories \fI/etc\fR and \fI/dev\fR"
- X.EX "diff passwd /etc" "Compares \fI./passwd\fR to \fI/etc/passwd"
- X.PP
- X\fIDiff\fR compares two files and generates a list of lines telling how
- Xthe two files differ. Lines may not be longer than 128 characters.
- XIf the two arguments on the command line are both directories,
- X\fIdiff\fR recursively steps through all subdirectories comparing
- Xfiles of the same name. If a file name is found only in one directory,
- Xa diagnostic message is written to \fIstdout\fR. A file that is of
- Xeither block special, character special or FIFO special type, cannot
- Xbe compared to any other file.
- XOn the other hand, if there is one directory and one file given on the
- Xcommand line, \fIdiff\fR tries to compare the file with the same name
- Xas \fIfile\fR in the directory \fIdirectory\fR.
- X
- X
- X
- /
- echo x - dis88
- sed '/^X/s///' > dis88 << '/'
- X.CD "dis88 \(en disassembler [IBM]"
- X.SX "dis88\fR [\fB\(eno\fR] \fIinfile\fR [\fIoutfile\fR]"
- X.FL "\(eno" "List the object code along with the assembly code"
- X.EX "dis88 a.out >listing" "Disassemble \fIa.out\fR"
- X.EX "dis88 \(eno a.out listing" "Ditto, but with object code"
- X.PP
- X\fIDis88\fR is an 8088 disassembler.
- XIt takes an executable file and prints the
- Xsymbolic assembly code that corresponds to it. If the executable file contains
- Xa symbol table (added by the program \fIast\fR), the symbol table
- Xinformation is used to give a more readable asembly listing.
- XMore information is provided in Chap. 9.
- X
- X
- X
- /
- echo x - diskcheck
- sed '/^X/s///' > diskcheck << '/'
- X.CD "diskcheck \(en check a disk for bad sectors"
- X.SX "diskcheck \fIdevice \fIstart \fIcount"
- X.FL "\fR(none)"
- X.EX "diskcheck /dev/at0 0 1200" "Check 1.2 MB diskette"
- X.EX "diskcheck /dev/at0 100 50" "Check blocks 100 to 149"
- X.PP
- X\fIDiskcheck\fR checks a disk for bad sectors by reading in each sector,
- Xwriting a known bit pattern onto it, reading it back in and comparing with
- Xwhat was written. This check is then done a second time. Bad sectors are
- Xreported. After each sector is tested, the original sector is restored.
- XOnly use this program on unmounted partitions.
- XKilling it part way through may result in lost data.
- X
- X
- X
- /
- echo x - diskcopy
- sed '/^X/s///' > diskcopy << '/'
- X.CD "diskcopy \(en copy a disk with only one drive [AMIGA]"
- X.SX "diskcopy"
- X.FL "\fR(none)"
- X.EY "diskcopy" "Copy a disk using the internal disk drive"
- X.PP
- XBefore using
- X.I diskcopy ,
- Xuse
- X.I chmem
- Xto increase the stack+malloc area to as much as you can get away with.
- XIn the ideal case you should
- X.I chmem
- Xit to a little over 720K (say, 750000) so you do not have to swap
- Xdisks.
- XIn this way, the entire diskette will be read in at once and stored in
- Xmemory.
- XOnce you have inserted the destination disk, the whole thing will be
- Xwritten back in one fell swoop, eliminating the need to constantly
- Xshuffle diskettes.
- X
- X
- X
- /
- echo x - diskrtc
- sed '/^X/s///' > diskrtc << '/'
- X.CD "diskrtc \(en set date from a disk controller real time clock [ATARI]"
- X.SX "diskrtc [bms1] [bms2] [supra] [icd]"
- X.FL "bms1 \fRRead the clock from a bms 100 disk controller"
- X.FL "bms2 \fRRead the clock from a bms 200 disk controller"
- X.FL "supra \fRRead the clock from a supra disk controller"
- X.FL "icd \fRRead the clock from an icd disk controller"
- X.EY "diskrtc icd" "Read the date from an icd disk controller"
- X.PP
- X.I Diskrtc
- Xreads the current date and time from the clock supplied on a disk
- Xcontroller and sets the time accordingly.
- XThis program is usually called from
- X.I /etc/rc .
- X
- X
- X
- /
- echo x - diskset
- sed '/^X/s///' > diskset << '/'
- X.CD "diskset \(en set real time clock on disk controller [ATARI]"
- X.SX "diskset [bms1] [bms2]"
- X.FL "bms1 \fRSet the clock of a bms 100 disk controller"
- X.FL "bms2 \fRSet the clock of a bms 200 disk controller"
- X.EY "diskset bms1" "Set the clock of a bms 100 disk controller"
- X.PP
- X.I Diskset
- Xinitializes the clock on a bms 100 or 200 diskcontroller with
- X.MX 's
- Xidea of the current date and time.
- X
- X
- X
- /
- echo x - dosdir
- sed '/^X/s///' > dosdir << '/'
- X.CD "dosdir \(en list an \s-2MS-DOS\s+2 directory [IBM]"
- X.SX "dosdir\fR [\fB\(enlr\fR] \fIdrive"
- X.FL "\(enl" "Long listing"
- X.FL "\(enr" "Recursively descend and print subdirectories"
- X.EX "dosdir \(enl A" "List root directory on drive A"
- X.EX "dosdir \(enr C x/y" "Recursively list directory \fIx/y\fR"
- X.PP
- X.I Dosdir
- Xreads standard IBM PC diskettes or hard disk partitions in
- X\s-2MS-DOS\s+2 format and lists their contents on standard output.
- XDirectory names should contain slashes to separate components, even though
- X\s-2MS-DOS\s+2 uses backslashes.
- XThe names
- X.I dosdir ,
- X.I dosread ,
- Xand
- X.I doswrite
- Xare all links to the same program.
- XThe program sees which function to perform by seeing how it was called.
- XA drive code of
- X.I A
- Xcauses the program to use \fI/dev/dosA\fR, for example,
- Xa link to \fI/dev/fd0\fR.
- XSimilarly, to have hard disk partition 1 be DOS drive C, \fI/dev/dosC\fR
- Xcould be a link to \fI/dev/hd1\fR, and so on for other drive codes.
- X
- X
- X
- /
- echo x - dosread
- sed '/^X/s///' > dosread << '/'
- X.CD "dosread \(en read a file from an \s-2MS-DOS\s+2 diskette [IBM]"
- X.SX "dosread\fR [\fB\(ena\fR] \fIdrive \fIfile"
- X.FL "\(ena" "ASCII file"
- X.EX "dosread C g/adv >adv" "Read file \fIg/adv\fR from hard disk"
- X.EX "dosread \(ena A prog.c >x" "Read ASCII file \fIprog.c\fR from drive A"
- X.PP
- X.I Dosread
- Xreads one \s-2MS-DOS\s+2 file and writes it on standard output.
- XThe file name must use slash, not backslash as a separator.
- XASCII files have the final CTRL-Z stripped, and carriage return plus
- Xline feed are mapped to line feed only, the usual
- X.MX
- Xconvention.
- XA drive code of
- X.I A
- Xcauses the program to use \fI/dev/dosA\fR, typically a link to \fI/dev/fd0\fR.
- XSimilarly, to have hard disk partition 1 be DOS drive C, \fI/dev/dosC\fR
- Xshould be a link to \fI/dev/hd1\fR, and so on for other drive codes.
- X
- X
- X
- /
- echo x - doswrite
- sed '/^X/s///' > doswrite << '/'
- X.CD "doswrite \(en write a file onto an \s-2MS-DOS\s+2 diskette [IBM]"
- X.SX "doswrite\fR [\fB\(ena\fR] \fIdrive \fIfile"
- X.FL "\(ena" "ASCII file"
- X.EX "doswrite A x/y <z" "Write file \fIz\fR to disk as \fIx/y\fR"
- X.EX "doswrite \(ena B f" "Copy \fIstdin\fR to \s-2MS-DOS\s+2 file \fIf\fR"
- X.PP
- X.I Doswrite
- Xwrites its \fIstdin\fR to an \s-2MS-DOS\s+2 file.
- XThe diskette or partition must be formatted and have an \s-2MS-DOS\s+2 file
- Xsystem already in place, including all the directories leading up to the file.
- XA drive code of
- X.I A
- Xcauses the program to use \fI/dev/dosA\fR, typically a link to \fI/dev/fd0\fR.
- XSimilarly, to have hard disk partition 1 be DOS drive C, \fI/dev/dosC\fR
- Xshould be a link to \fI/dev/hd1\fR, and so on for other drive codes.
- X
- X
- X
- /
- echo x - du
- sed '/^X/s///' > du << '/'
- X.CD "du \(en print disk usage"
- X.SX "du\fR [\fB\(enas\fR]\fR [\fB\(enl \fIn\fR] \fIdir\fR ..."
- X.FL "\(ena" "Give usage for all files"
- X.FL "\(enl" "List up to \fIn\fR levels of subdirectories"
- X.FL "\(ens" "Summary only"
- X.EX "du dir" "List disk space used by files in dir"
- X.EX "du \(ens dir1 dir2" "Give summaries only"
- X.PP
- X\fIDu\fR examines one or more directories and prints the amount of space
- Xoccupied by the files in those directories and their subdirectories.
- X
- X
- X
- /
- echo x - echo
- sed '/^X/s///' > echo << '/'
- X.CD "echo \(en print the arguments"
- X.SX "echo\fR [\fB\(enn\fR] \fIargument\fR ..."
- X.FL "\(enn" "No line feed is output when done"
- X.EX "echo Start Phase 1" "\*(OQStart Phase 1\*(CQ is printed"
- X.EX "echo \(enn Hello" "\*(OQHello\*(CQ is printed without a line feed"
- X.PP
- X.I Echo
- Xwrites its arguments to standard output.
- XThey are separated by blanks and terminated with a line feed unless
- X.B \(enn
- Xis present.
- XThis command is used mostly in shell scripts.
- X
- X
- X
- /
- echo x - ed
- sed '/^X/s///' > ed << '/'
- X.CD "ed \(en editor"
- X.SX "ed \fIfile"
- X.FL "\fR(none)"
- X.EY "ed prog.c" "Edit \fIprog.c\fR"
- X.PP
- X\fIEd\fR is functionally equivalent to the standard V7 editor, ed.
- XIt supports the following commands:
- X.HS
- X.nf
- X.ta 0.5i 0.95i
- X (.) a: append
- X (.,.) c: change
- X (.,.) d: delete
- X e: edit new file"
- X f: print name of edited file"
- X (1,$) g: global command
- X (.) i: insert
- X (.,.+1) j: join lines together
- X (.) k: mark
- X (.) l: print with special characters in octal
- X (.,.) m: move
- X (.,.) p: print
- X q: quit editor"
- X (.) r: read in new file
- X (.,.) s: substitute
- X (1,$) v: like g, except select lines that do not match
- X (1,$) w: write out edited file
- X.fi
- X
- XMany of the commands can take one or two addresses, as indicated above. The
- Xdefaults are shown in parentheses. Thus \fIa\fR appends to the current
- Xline, and \fIg\fR works on the whole file as default.
- XThe dot refers to the current line.
- XBelow is a sample editing session with comments given following the # symbol.
- X.HS
- X.nf
- X.ta 0.5i 2.5i
- X ed prog.c # Edit prog.c
- X 3,20p # Print lines 3 through 20
- X /whole/ # Find next occurence of \fIwhole\fR
- X s/whole/while/ # Replace \fIwhole\fR by \fIwhile\fR
- X g/Buf/s//BUF/g # Replace \fIBuf\fR by \fIBUF\fR everywhere
- X w # Write the file back
- X q # Exit the editor
- X.fi
- X\fIEd\fR is provided for its sentimental value.
- XIf you want a line-oriented editor, try \fIex\fR.
- XIf you want a good editor, use \fIelle\fR, \fIelvis\fR, or \fImined\fR.
- X
- X
- X
- /
- echo x - eject
- sed '/^X/s///' > eject << '/'
- X.CD "eject \(en eject a diskette from a drive [MACINTOSH]"
- X.SX "eject [\fIdrive\fR]"
- X.FL "\fR(none)"
- X.EX "eject" "Eject the diskette in drive 0"
- X.EX "eject 2" "Eject the diskette in drive 2"
- X.PP
- X.I Eject
- Xwill eject the diskette from the specified drive (or drive 0 if no
- Xdrive is specified).
- X
- X
- X
- /
- echo x - elle
- sed '/^X/s///' > elle << '/'
- X.CD "elle \(en ELLE Looks Like Emacs"
- X.SX "elle \fIfile\fR [\fIfile2\fR]"
- X.FL "\fR(none)"
- X.EY "elle file.c" "Start the editor"
- X.PP
- X\fIElle\fR is a screen-oriented editor that is patterned after Emacs.
- XIt can edit multiple files, regardless of their length,
- Xcan support 1 or 2 windows, and has many other powerful features.
- XAn \fIelle\fR manual is given in Chap. 9.
- X
- X
- X
- /
- echo x - elvis
- sed '/^X/s///' > elvis << '/'
- X.CD "elvis \(en clone of the Berkeley vi editor"
- X.SX "elvis \fR[\fB\(enRerv\fR] [\fB\(ent \fItag\fR] \fR[\fIfile\fR] ..."
- X.FL "\(enR" "Set the read-only option"
- X.FL "\(ene" "Start up emulating \fIex\fR"
- X.FL "\(enr" "Tell the user to use \fIvirecover\fR instead
- X.FL "\(ent" "Start editing at the given tag"
- X.FL "\(env" "Start up emulating \fIvi\fR"
- X.EX "elvis" "Call the editor"
- X.EX "elvis prog.c" "edit \fIprog.c\fR"
- X.PP
- X\fIElvis\fR is a screen editor patterned very closely after the Berkeley
- X\fIvi\fR editor.
- XIt has many commands, described in Chap. 9.
- XSee also \fIctags\fR, \fIex\fR, \fIref\fR, and \fIvirecover\fR.
- X
- X
- X
- /
- echo x - ex
- sed '/^X/s///' > ex << '/'
- X.CD "ex \(en Berkeley line editor"
- X.SX "ex \fR[\fB\(enRerv\fR] [\fB\(ent \fItag\fR] \fR[\fIfile\fR] ..."
- X.FL "\(enR" "Set the readonly option"
- X.FL "\(ene" "Start up emulating \fIex\fR"
- X.FL "\(enr" "Tell the user to use \fIvirecover\fR instead
- X.FL "\(ent" "Tagstart editing at the given tag"
- X.FL "\(env" "Start up emulating \fIvi\fR"
- X.EX "ex" "Call the editor"
- X.EX "ex prog.c" "edit \fIprog.c\fR"
- X.PP
- X\fIEx\fR is a line editor patterned very closely after the Berkeley
- Xprogram of the same name.
- XIt is essentially a much improved version of \fIed\fR.
- XActually, \fIex\fR is really just a link to \fIelvis\fR, which is a
- X\fIvi\fR clone.
- XIts commands are described in Chap. 9.
- XSee also \fIctags\fR, \fIelvis\fR, \fIref\fR, and \fIvirecover\fR.
- X
- X
- X
- /
- echo x - expand
- sed '/^X/s///' > expand << '/'
- X.CD "expand \(en convert tabs to spaces"
- X.SX "expand\fR [\fB\(en\fIt1,t2, ...\fR]\fR [\fIfile\fR]
- X.FL "\(en\fIt\fR" "Tab stop positions"
- X.EY "expand \(en16,32,48,64" "Expand \fIstdin\fR with tabs every 16 columns"
- X.PP
- X\fIExpand\fR replaces tabs in the named files with the equivalent numbers
- Xof spaces. If no files are listed, \fIstdin\fR is given. If only one
- Xtab is given, the rest are multiples of it. The default is a tab every 8
- Xspaces.
- X
- X
- X
- /
- echo x - expr
- sed '/^X/s///' > expr << '/'
- X.CD "expr \(en evaluate experession"
- X.SX "expr \fIarg ..."
- X.FL "\fR(none)"
- X.EY "x=\`expr \$x + 1\`" "Add 1 to shell variable x"
- X.PP
- X\fIExpr\fR computes the value of its argument and writes the result on
- Xstandard output. The valid operators, in order of increasing precedence,
- Xare listed below. Operators grouped by {...} have the same precedence.
- XThe operators are: |, &, {<, <=, ==, !=, >=, >}, {+, \(en}, *, /, %, and :.
- XParentheses are permitted.
- X
- X
- X
- /
- echo x - factor
- sed '/^X/s///' > factor << '/'
- X.CD "factor \(en factor an integer less than 2**31"
- X.SX "factor \fInumber"
- X.FL "\fR(none)"
- X.EY "factor 450180" "Print the prime factors of 450180"
- X.PP
- X\fIFactor\fR prints the prime factors of its argument in increasing order.
- XEach factor is printed as many times as it appears in the number.
- X
- X
- X
- /
- echo x - fdisk
- sed '/^X/s///' > fdisk << '/'
- X.CD "fdisk \(en partition a hard disk [IBM]"
- X.SX "fdisk\fR [\fB\(enh\fIm\fR]\fR [\fB\(ens\fIn\fR]\fR [\fIfile\fR]"
- X.FL "\fB\(enh" "Number of disk heads is \fIm\fR"
- X.FL "\fB\(ens" "Number of sectors per track is \fIn\fR"
- X.EX "fdisk /dev/hd0" "Examine disk partitions"
- X.EX "fdisk \(enh9 /dev/hd0" "Examine disk with 9 heads"
- X.PP
- XWhen \fIfdisk\fR starts up, it reads in the partition table and displays
- Xit.
- XIt then presents a menu to allow the user to modify partitions, store the
- Xpartition table on a file, or load it from a file. Partitions can be marked
- Xas
- X.MX ,
- XDOS or other, as well as active or not.
- XUsing \fIfdisk\fR is self-explanatory.
- XHowever, be aware that
- Xrepartitioning a disk will cause information on it to be lost.
- XRebooting the system \fIimmediately\fR
- Xis mandatory after changing partition sizes and parameters.
- X.MX ,
- X\&\s-2XENIX\s0, \s-2PC-IX\s0, and \s-2MS-DOS\s0 all have different
- Xpartition numbering schemes.
- XThus when using multiple systems on the same disk, be careful.
- X.PP
- XFurthermore,
- X.MX
- Xexpects all partitions to begin on an even sector. The \fIm\fR command, which
- Xmarks a partition as
- X.MX ,
- Xautomatically rounds odd partitions upward.
- XThe reason that odd partition sizes do not cause a problem with
- X\s-2MS-DOS\s0 is that \s-2MS-DOS\s0 allocates disk space in units of
- X512-byte sectors, whereas
- X.MX
- Xuses 1K blocks.
- XThus an odd number of sectors is no problem for
- X\s-2MS-DOS\s0 but it is a problem for
- X.MX .
- XThat is why a command has been provided to round
- X.MX
- Xpartitions to an even starting address and an even size.
- XIf your disk has partitions for both \s-2MS-DOS\s0 and
- X.MX ,
- Xonly the
- X.MX
- Xones should be rounded off.
- X\fIFdisk\fR has a variety of other features that can be seen by typing \fIh\fR.
- X
- X
- X
- /
- echo x - fgrep
- sed '/^X/s///' > fgrep << '/'
- X.CD "fgrep \(en fast grep"
- X.SX "fgrep\fR [\fB\(encfhlnsv\fR]\fR [\fIstring_file\fR] [\fIstring\fR] [\fIfile\fR] ..."
- X.FL "\(enc" "Count matching lines and only print count, not the lines"
- X.FL "\(enf" "Take strings from file named in following argument"
- X.FL "\(enh" "Omit file headers from printout"
- X.FL "\(enl" "List file names once only"
- X.FL "\(enn" "Each line is preceded by its line number"
- X.FL "\(ens" "Status only, no output"
- X.FL "\(env" "Print only lines not matching"
- X.EX "fgrep % prog.c" "Print lines containing % sign"
- X.EX "fgrep \(enf pattern prog.c" "Take strings from \fIpattern\fR"
- X.PP
- X\fIFgrep\fR is essentially the same as grep, except that it only searches
- Xfor lines containing literal strings (no wildcard characters), and it is much
- Xfaster.
- X
- X
- X
- /
- echo x - file
- sed '/^X/s///' > file << '/'
- X.CD "file \(en make a guess as to a file's type based on contents"
- X.SX "file \fIname ..."
- X.FL "\fR(none)"
- X.EY "file a.out ar.h" "Guess at types"
- X.PP
- X\fIFile\fR reads the first block of a file and tries to make an
- Xintelligent guess about what kind of file it is.
- XIt understands about archives, C
- Xsource programs, executable binaries, shell scripts, and English text.
- X
- X
- X
- /
- echo x - find
- sed '/^X/s///' > find << '/'
- X.CD "find \(en find files meeting a given condition"
- X.SX "find \fIdirectory \fIexpression"
- X.FL "\fR(none)"
- X.EX "find / \(enname a.out \(enprint~~~~~~~~~~~~~~~~" "Print all \fIa.out\fR paths"
- X.EX "find /usr/ast ! \(ennewer f \(enok rm {} \\\\\^;~~~~~~~~~~" "Ask before removing"
- X.EX "find /usr \(ensize +20 \(enexec mv {} /big \\\\\^;~~~~~" "move files > 20 blks"
- X.EX "find / \( \(enname a.out \(eno \(enname \(fm*.o\(fm \) \(enexec rm {}\\\\\^;" "2 conds"
- X.PP
- X\fIFind\fR descends the file tree starting at the given directory checking
- Xeach file in that directory and its subdirectories against a predicate.
- XIf the predicate is true, an action is taken. The predicates may be
- Xconnected by \fB\(ena\fR (Boolean and), \fB\(eno\fR (Boolean or) and !
- X(Boolean negation).
- XEach predicate is true under the conditions specified below. The integer
- X\fIn\fR may also be +\fIn\fR to mean any value greater than \fIn\fR,
- X\fI\(enn\fR to mean any value less than
- X\fIn\fR, or just \fIn\fR for exactly \fIn\fR.
- X.HS
- X.ta 0.25i 1.0i
- X.nf
- X \(enname s true if current filename is \fIs\fR (include shell wild cards)
- X \(ensize n true if file size is \fIn\fR blocks
- X \(eninum n true if the current file's i-node number is \fIn\fR
- X \(enmtime n true if modification time relative to today (in days) is \fIn\fR
- X \(enlinks n true if the number of links to the file is \fIn\fR
- X \(ennewer f true if the file is newer than \fIf\fR
- X \(enperm n true if the file's permission bits = \fIn\fR (\fIn\fR is in octal)
- X \(enuser u true if the uid = \fIu\fR (a numerical value, not a login name)
- X \(engroup g true if the gid = \fIg\fR (a numerical value, not a group name)
- X \(entype x where \fIx\fR is \fBbcdfug\fR (block, char, dir, regular file, setuid, setgid)
- X \(enxdev do not cross devices to search mounted file systems
- X.fi
- X.HS
- XFollowing the expression can be one of the following, telling what to do
- Xwhen a file is found:
- X.HS
- X.nf
- X \(enprint print the file name on standard output
- X \(enexec execute a \s-2MINIX\s0 command, {} stands for the file name
- X \(enok prompts before executing the command
- X.fi
- X.HS
- X
- X
- X
- /
- echo x - fix
- sed '/^X/s///' > fix << '/'
- X.CD "fix \(en generate new file from old one and diff listing"
- X.SX "fix \fIoldfile \fIdifflist \fI>newfile"
- X.FL "\fR(none)"
- X.EY "fix old difflist >new" "Generate new from old and diffs"
- X.PP
- X\fIFix\fR accepts a diff listing produced by diff and reconstructs the
- Xnew file. It is common for people to take a file, modify it, and then
- Xsend the diff listing between the old and new files to other people.
- XUsing \fIfix\fR, the old file, and the diff listing, it is possible to creat
- Xthe new file. For example:
- X.HS
- X diff oldfile newfile >difflist
- X fix oldfile difflist >new2
- X.HS
- Xwill generate a file \fInew2\fR that is identical to \fInewfile\fR.
- XA more sophisticated alternative to \fIfix\fR is \fIpatch\fR,
- Xas \fIfix\fR only handles old-style diffs.
- X
- X
- X
- X.SP 1
- /
- echo x - fold
- sed '/^X/s///' > fold << '/'
- X.CD "fold \(en fold long lines"
- X.SX "fold\fR [\fB\(en\fIn\fR]\fR [\fIfile\fR] ..."
- X.FL "\(en\fIn\fR" "How long should the output lines be"
- X.EX "fold \(en60" "Fold \fIstdin\fR to 60 characters"
- X.EX "fold file" "Fold \fIfile\fP to 80 characters"
- X.PP
- X\fIFold\fR takes copies its input from the named file (or \fIstdin\fR,
- Xif none is specified) to standard output.
- XHowever, lines longer than the given maximum (default 80) are broken
- Xinto multiple lines of the maximum length by inserting new line characters.
- X
- X
- X
- /
- echo x - format
- sed '/^X/s///' > format << '/'
- X.CD "format - format a diskette [IBM]"
- X.SX "format [\fB\(ena\fR][\fB\(enq\fR][\fISpecial\fR [\fIkbsize\fR]] [\fB\(env [\fBdosvollabel\fR]\fR]"
- X.FL "\(ena" " Sort interactive list alphabetically not by size"
- X.FL "\(enq" "Quiet mode: skips asking if you are sure"
- X.FL "\(env" "Volume label added along with DOS structures"
- X.EX "format" "Have \fIformat\fR display a menu"
- X.EX "format /dev/at0" "format disk in /dev/at0"
- X.EX "format /dev/at0 360" "Format disk with 360 blocks"
- X.EX "format /dev/dosA" "Format for DOS"
- X.EX "format /dev/fd1 -v DOS_DISK" "Format and label DOS disk"
- X.PP
- X\fIFormat\fR allows the superuser to format diskettes.
- XIt can format all seven non-automatic
- Xdisk/media combinations that PC-Minix supports. It will also try to
- Xformat automatics, minor devices 0 through 3, if a device size is nozero.
- X\fIFormat\fR will optionally add the structures \s-2MS-DOS\s0 needs if either the device
- Xname is an \s-2MS-DOS\s0 device, like \fI/dev/dosA\fR, or if the
- X\\fB\(env\fR flag is used.
- XIf no special file is specified in the command line \fIformat\fR will
- Xdisplay a menu of choices.
- XIt then allows automatic devices to be formatted even if
- Xthey were made with a size of zero.
- X\fIarning:\fR Some disk drives are media sensitive, in which case
- Xthe diskette must match the drive (e.g., no 360K diskettes in 1.2M drives).
- X
- X
- X
- X.CD "format \(en format a diskette [ATARI]"
- X.SX "format \fIdevice\fR"
- X.EY "format /dev/dd0" "Format a double sided diskette"
- X.PP
- X.I Format
- Xformats and verifies a diskette on the given device.
- XDepending on the device specified the disk is formatted single or
- Xdouble sided. Formatted disks always contain 80 tracks and 9 sectors
- Xper track. The diskettess can be used under both
- X.MX
- Xand TOS.
- X
- X
- X
- /
- echo x - fortune
- sed '/^X/s///' > fortune << '/'
- X.CD "fortune \(en print a fortune"
- X.SX "fortune"
- X.FL "\fR(none)"
- X.EY "fortune" "Print a fortune"
- X.PP
- X\fIFortune\fR prints a fortune at random from the fortunes file,
- X\fI/usr/lib/fortune.dat\fR. This file consists of pieces
- Xof text separated by a line containing only %%.
- X
- X
- X
- /
- echo x - from
- sed '/^X/s///' > from << '/'
- X.CD "from \(en input half of a connection [IBM]"
- X.SX "from \fIport"
- X.FL "\fR(none)"
- X.EX "from port | sort >x" "Fetch and sort an incoming file"
- X.EX "from abc | sh" "Primitive sherver"
- X.PP
- X\fITo\fR and \fIfrom\fR are used together to provide connection-oriented service over an Ethernet.
- XOn the sending machine, the last member of a pipeline is \fIto port\fR.
- XOn the
- Xreceiving machine, the first member of a pipe line is \fIfrom port\fR.
- XThe net
- Xresult is that the output of the sending pipeline goes into the input of the
- Xreceiving pipeline, making pipelines work across the network.
- XSee also \fIto\fR.
- X
- X
- X
- /
- echo x - fsck
- sed '/^X/s///' > fsck << '/'
- X.CD "fsck \(en perform file system consistency check"
- X.SX "fsck\fR [\fB\(enaclmrs\fR]\fR [\fIdevice\fR] ..."
- X.FL "\(ena" "Automatically repair inconsistencies"
- X.FL "\(enc" "Check and list only the specified i-nodes
- X.FL "\(enl" "List the files and directories in the filesytem
- X.FL "\(enr" "Prompt user for repairs if inconsistencies are found
- X.FL "\(ens" "List the superblock of the file system"
- X.EX "fsck /dev/hd4" "Check file system on \fI/dev/hd4\fR"
- X.EX "fsck \(ena /dev/at0" "Automatically fix errors on \fI/dev/at0\fR"
- X.EX "fsck \(enl /dev/fd0" "List the contents of \fI/dev/fd0\fR"
- X.EX "fsck \(enc 2 3 /dev/hd3" "Check and list \fI/dev/hd3\fR i-nodes 2 & 3"
- X.PP
- X\fIFsck\fR performs consistency checks on the file systems which reside
- Xon the specified devices.
- XWhen either the \fB\(ena\fR or \fB\(enr\fR flags are given, the file system
- Xwill be repaired if errors are found.
- XBefore running \fIfsck\fR on a mounted file system, it must first be unmounted.
- XTrying to repair a mounted file system is dangerous and should not be
- Xattempted.
- X.PP
- XTo repair the root file system (which cannot be unmounted), first
- Xhit the F1 key to find the pid of the \fI/etc/update\fR process.
- XThen become superuser and send \fIupdate\fR signal 9 using \fIkill\fR.
- XAfter doing this, hit F1 again to verify that \fI/etc/update\fR has vanished.
- XNext run \fIfsck\fR and then immediately reboot
- Xthe computer, WITHOUT doing a \fIsync\fR.
- X.PP
- XThis is the only situation in which you can (in fact, must) reboot without
- Xdoing a \fIsync\fR.
- XRebooting is needed because \fIfsck\fR repairs the disk but does not affect
- Xthe (possibly incorrect) information held in memory.
- XDoing a \fIsync\fR would force the (possibly incorrect) information from
- Xmemory back onto the disk, thus ruining the work done by \fIfsck\fR.
- XBy rebooting immediately, memory is reloaded with correct information from the
- Xdisk.
- XIt is necessary to kill \fI/etc/update\fR before repairing the root file system
- Xto prevent it from issuing \fIsync\fR calls while \fIfsck\fR is running.
- XBecause \fI/etc/update\fR only affects mounted file systems (and the root),
- Xwhen repairing a nonroot file system, unmounting it is sufficient; it is not
- Xnecessary to kill \fI/etc/update\fR.
- X
- X
- X
- X.SP 1
- /
- echo x - gather
- sed '/^X/s///' > gather << '/'
- X.CD "gather \(en gather up the files in a directory for transmission"
- X.SX "gather\fR [\fB\(ens\fR] \fIsource_dir [\fB\(end\fR] dest_dir\fR [\fB\(enb\fR] \fIbytes\fR [\fB\(enf\fR] \fIfile\fR
- X.FL "\(enb" "Desired number of bytes per output file"
- X.FL "\(end" "Destination directory"
- X.FL "\(enf" "Base name of output files"
- X.FL "\(ens" "Source directory"
- X.EX "gather" "Collect files in current dir into 60K archives"
- X.EX "gather \(end dir" "Put the archives in \fIdir\fR
- X.EX "gather \(enb 90000" "Try to produce 90K archives"
- X.EX "gather \(ens .. \(end targ \(enb 5000" "Try to produce 5K archives"
- X.PP
- XIt is often useful to collect all the files in a directory into one or
- Xmore archives for transmission by mail. This program collects all the
- Xfiles in the source directory (default: current directory) and puts
- Xthem into a shar archive. The shar archive is then compressed and
- Xuuencoded. An attempt is made to have the final \fI.uue\fR file be
- Xabout the given size (default: 60K), but since \fIgather\fR cannot really
- Xpredict how much \fIshar\fR will add to the file, how much \fIcompress\fR
- Xwill reduce the file, and how much \fIuue\fR will add again, the sizes
- Xcan fluctuate. If the \fB\(enf \fIfile\fR flag is given, the archives will
- Xbe given the names \fIfile_00.uue\fR, \fIfile_01.uue\fR etc. If \fB\(enf\fR
- Xis not given, the name of the source directory is used as the base name.
- XSince 7 characters of suffix are appended, the base name should not exceed
- X7 characters.
- X
- X
- X
- X.SP -0.5
- /
- echo x - getlf
- sed '/^X/s///' > getlf << '/'
- X.CD "getlf \(en wait until a line has been typed"
- X.SX "getlf\fR [\fIargument\fR]"
- X.FL "\fR(none)"
- X.EY "getlf" "Wait for a line"
- X.PP
- XIn shell scripts it is sometimes necessary to pause to give the user a
- Xchance to perform some action, such as inserting a diskette.
- XThis command prints its argument, if any,
- Xand then waits until a carriage return has been typed, at which
- Xtime it terminates.
- XIt is used in
- X.I /etc/rc .
- X.SP -0.5
- X
- X
- /
- echo x - getty
- sed '/^X/s///' > getty << '/'
- X.CD "getty \(en get terminal line parameters for login"
- X.SX "getty\fI line \fR[\fB\(enc \fIfile\fR] [\fB\(enh\fR] [\fB\(enk\fR] [\fB\(ent\fR] [\fIspeed\fR]
- X.FL "\(enc" "Use \fIfname\fR as \fIgettydefs\fR file"
- X.FL "\(enh" "Do not hang up the phone after reset"
- X.FL "\(enk" "Do not use speed selection"
- X.FL "\(ent" "Do not time out at \fILogin:\fR prompt"
- X.EY "/etc/getty /dev/tty1 1200" "Connect to \fItty1 at 1200 baud\fR"
- X.PP
- XThe \fIgetty\fR program allows a terminal port to be used for both dialin and
- Xdialout. It also detects the speed used, and, if enabled, it sets the
- Xvarious line discipline parameters.
- XWhen \fIgetty\fR starts up, it searches through the \fI/etc/gettydefs\fR
- Xfile until it finds an entry that matches the label as specified in the
- X\fIspeed\fR parameter.
- XIf no paramater is present, the first entry is used. \fIGetty\fR
- Xthen sets up the terminal line according to the initial parameters
- Xfield found in \fIgettydefs\fR.
- X
- X
- X
- X.SP 1
- /
- echo x - grep
- sed '/^X/s///' > grep << '/'
- X.CD "grep \(en search a file for lines containing a given pattern"
- X.SX "grep\fR [\fB\(enelnsv\fR] \fIpattern\fR [\fIfile\fR] ..."
- X.FL "\(ene" "\fB\(ene \fIpattern\fR is the same as \fIpattern\fP
- X.FL "\(enl" "Do not print line numbers"
- X.FL "\(enn" "Print line numbers"
- X.FL "\(ens" "Status only, no printed output"
- X.FL "\(env" "Select lines that do not match"
- X.EX "grep mouse file " "Find lines in \fIfile\fP containing \fImouse\fP"
- X.EX "grep [0\(en9] file" "Print lines containing a digit"
- X.PP
- X.I Grep
- Xsearches one or more files (by default, \fIstdin\fR) and selects out
- Xall the lines that match the pattern.
- XAll the regular expressions accepted by
- X.I ed
- Xand
- X.I mined
- Xare allowed.
- XIn addition, + can be used instead of \(** to mean 1 or more occurrences,
- X? can be used to mean 0 or 1 occurrences, and
- X| can be used between two regular expressions to mean either
- Xone of them.
- XParentheses can be used for grouping.
- XIf a match is found, exit status 0 is returned.
- XIf no match is found, exit status 1 is returned.
- XIf an error is detected, exit status 2 is returned.
- X
- X
- X
- /
- echo x - gres
- sed '/^X/s///' > gres << '/'
- X.CD "gres \(en grep and substitute"
- X.SX "gres\fR [\fB\(eng\fR] \fIpattern \fIstring\fR [\fIfile\fR] ..."
- X.FL "\(eng" "Only change the first occurrence per line"
- X.EX "gres bug insect" "Replace \fIbug\fP with \fIinsect\fP"
- X.EX "gres \*(SQ^[A\(enZ]+$\*(SQ CAPS" "Replace capital-only lines with \fICAPS\fP"
- X.PP
- X.I Gres
- Xis a poor man's
- X.I sed .
- XIt looks for the same patterns as
- X.I grep ,
- Xand replaces each one by the given string.
- X
- X
- X
- X.SP 1.5
- /
- echo x - hdclose
- sed '/^X/s///' > hdclose << '/'
- X.CD "hdclose \(en close hard disk partition [MACINTOSH]"
- X.SX "hdclose \fIdevice\fR"
- X.FL "\fR(none)"
- X.EX "hdclose /dev/hd3" "Disconnect \fIhd3\fR from its current Macintosh file"
- X.PP
- X.I Hdclose
- Xwill disconnect the current Macintosh file from the given hard disk
- Xpartition. See also \fIhdopen\fR. You \fBmust\fR unmount the file system
- X\fBbefore\fR you close it.
- X
- X
- X
- X.SP 1.5
- /
- echo x - hdopen
- sed '/^X/s///' > hdopen << '/'
- X.CD "hdopen \(en set correspondence of a HD partition [MACINTOSH]"
- X.SX "hdopen \fIvol:dir:file\fR \fIdevice\fR"
- X.FL "\fR(none)"
- X.EX "hdopen vol:dir:file /dev/hd3" "Set \fIhd3\fR to Macintosh file \fIfile\fR"
- X.PP
- X.I Hdopen
- Xwill set up a correspondence between the given Macintosh file and
- Xa
- X.MX
- Xhard disk partition. On the Macintosh,
- X.MX
- Xhard disk partitions are nothing more than a standard Macintosh file.
- XThis program will set the given hard disk partition to the given file.
- XIf a file is already associated with that partition, you must first use
- X\fIhdclose\fR.
- X
- X
- X
- /
- echo x - head
- sed '/^X/s///' > head << '/'
- X.CD "head \(en print the first few lines of a file"
- X.SX "head\fR [\fB\(en\fIn\fR]\fR [\fIfile\fR] ..."
- X.FL "\(en\fIn\fR" "How many lines to print"
- X.EX "head \(en6" "Print first 6 lines of \fIstdin\fR"
- X.EX "head \(en1 file1 file2" "Print first line of two files"
- X.PP
- XThe first few lines of one or more files are printed.
- XThe default count is 10 lines.
- XThe default file is \fIstdin\fR.
- X
- X
- X
- X.SP 1.5
- /
- echo x - ic
- sed '/^X/s///' > ic << '/'
- X.CD "ic \(en integer calculator"
- X.SX "ic\fR [\fIexpression\fR]"
- X.FL "\fR(none)"
- X.EX "ic~~~~" "Start the calculator"
- X.EX "ic 250 300+" "Start calculator with 550 on the stack"
- X.PP
- X\fIIc\fR is a reverse Polish notation calculator that works on 32-bit integers.
- XIt starts out by computing the expression given as an argument, if any, and
- Xthen expects keyboard input. As an example, to compute \*(OQ23+5\*(CQ one
- Xfirst converts this to reverse Polish, \*(OQ23 5+\*(CQ.
- XAfter the calculator starts, type \*(OQ23\*(CQ followed by a carriage return.
- XThen type \*(OQ5\*(CQ and another carriage return.
- XFinally type \*(OQ+\*(CQ to see the result, 28 displayed on the stack.
- XOther operations work the same way. The calculator can use other radices for
- Xinput and output, and has registers that can be stored and loaded. The \fIh\fR
- Xcommand gives the help menu. See also Chap. 9.
- X
- X
- X
- X.SP 0.4
- /
- echo x - id
- sed '/^X/s///' > id << '/'
- X.CD "id \(en print the uid and gid"
- X.SX "id"
- X.FL "\fR(none)"
- X.EY "id" "Print the uid and gid"
- X.PP
- X\fIId\fR prints the current uid and gid, both numerically and symbolically.
- XIf the effective uid and gid are different from the real ones, all of them
- Xare printed.
- X
- X
- X
- X.SP 0.4
- /
- echo x - ifdef
- sed '/^X/s///' > ifdef << '/'
- X.CD "ifdef \(en remove #ifdefs from a file"
- X.SX "ifdef \fR[\fB\(ent\fR] [\fB\(end\fIsymbol\fR] [\fB\(enD\fIsymbol\fR] [\fB\(enU\fIsymbol\fR] [\fB\(enI\fIsymbol\fR] [file]"
- X.FL "\(enD" "Define symbol permanently"
- X.FL "\(enI" "Ignore symbol"
- X.FL "\(enU" "Undefine symbol permanently"
- X.FL "\(end" "Define symbol. It may be #undef'ed later"
- X.FL "\(ent" "Produce a table of the symbols on \fIstdout\fR"
- X.EX "ifdef \(enDUNIX file.c >newfile.c" "Define \fIUNIX\fR"
- X.EX "ifdef \(enD_MINIX \(enUDOS <x.c >y.c "Define \fI_MINIX\fR, undefine \fIDOS\fR"
- X.PP
- X\fIIfdef\fR
- Xallows conditional code [ #ifdef ... #endif ]
- Xto be selectively removed from C files, but at the same time leaving
- Xall other C preprocessor commands intact such as #define, #include etc.
- XInput to
- X.I ifdef
- Xis either the file named as the last argument, or \fIstdin\fR if no file
- Xis named.
- XOutput goes to \fIstdout\fR.
- X.PP
- XSymbols may be defined with the \fB\(end\fR or \fB\(enD\fR flags just like
- X\fIcpp\fR, except that the latter option ignores subsequent \fI#undefs\fR.
- XIt is not permitted to give values to symbols.
- XSimilarly, \fB\(enU\fR undefines a symbol and ignores subsequent
- X\fI#defines\fRs.
- XSymbols defined with \fB\(enI\fR are ignored; any \fI#ifdef\fR using an
- Xignored symbol will be left intact.
- X
- X
- X
- /
- echo x - indent
- sed '/^X/s///' > indent << '/'
- X.CD "indent \(en reformat the layout of a program"
- X.SX "indent \fIin_file\fR [\fIout_file\fR] [\fIoptions\fR]
- X.FL "\fR(many)"
- X.EX "indent \(enbr \(enc25 prog.c " "Indent \fIprog.c\fR
- X.EX "indent \(ennpcs prog.c newprog.c" "Put output on \fInewprog.c"
- X.PP
- X\fIIndent\fR reformats a C program according to a set of options provided.
- XMost of the common choices are available.
- XThe output file replaces the input file, unless an explicit output file
- Xis specified (but a backup is made of the original with suffix \fI.BAK\fR).
- XThe options are given in Chap. 9.
- X
- X
- X
- /
- echo x - inodes
- sed '/^X/s///' > inodes << '/'
- X.CD "inodes \(en print i-node information"
- X.SX "inodes"
- X.FL "\fR(none)"
- X.EX "inodes" "Print information about file names typed in"
- X.EX "cd /dev; ls | inodes" "Print information about the special files"
- X.PP
- X\fIInodes\fR expects a list of file names on \fIstdin\fR, one file name
- Xper line.
- XFor each file named, the file type, mode, uid, gid, checksum, length,
- Xand name is printed.
- XThe checksum is the same as used by \fIcrc\fR.
- XThis program provides a way to see the sizes of the block special
- Xfiles in \fI/dev\fR, as shown in the second example above.
- X
- X
- X
- /
- echo x - kermit
- sed '/^X/s///' > kermit << '/'
- X.CD "kermit \(en transfer a file using the kermit protocol"
- X.SX "kermit"
- X.FL "\fR(many)"
- X.EY "kermit" "Start kermit"
- X.PP
- X\fIKermit\fR is a file transfer program, remote connection program, and
- Xmuch more.
- XEven summarizing it here would be out of the question.
- XFor a description of it, see the 379 page book
- X\fIKermit: A File Transfer Protocol\fR
- Xby Frank da Cruz, Digital Press, 1987, ISBN 0-932376-88-6, and also
- XChap. 9.
- X
- X
- X
- /
- echo x - kill
- sed '/^X/s///' > kill << '/'
- X.CD "kill \(en send a signal to a process"
- X.SX "kill\fR [\fB\(en\fIn\fR] \fIprocess"
- X.FL "\(en\fIn\fR" "Signal number to send"
- X.EX "kill 35" "Send signal 15 to process 35"
- X.EX "kill \(en9 40" "Send signal 9 to process 40"
- X.EX "kill \(en2 0" "Send signal 2 to whole process group"
- X.PP
- XA signal is sent to a given process.
- XBy default signal 15 (SIGTERM) is sent.
- XProcess 0 means all the processes in the sender's process group.
- X
- X
- X
- /
- echo x - last
- sed '/^X/s///' > last << '/'
- X.CD "last \(en display recent on-line session records"
- X.SX "last\fR [\fB\(enf \fIfile\fR]\fR [\fB\(enr\fR] [\fB\(en\fIn\fR] [\fIname\fR] [\fItty\fR] ..."
- X.FL "\(enf" "Use \fIfile\fR instead of /usr/adm/wtmp"
- X.FL "\(enr" "Search backwards only to last reboot"
- X.FL "\(en\fIn\fP" "Print a maximum of \fIn\fR lines"
- X.EX "last reboot" "When was the system last rebooted?"
- X.EX "last ast" "When was the last login for ast?"
- X.EX "last \(en10 tty0 tty1" "Display last 10 logins on tty0 or tty1"
- X.PP
- X.I Last
- XSearches backward through the login administration file (default is
- X\fI/usr/adm/wtmp\fR), printing information about previous logins and
- Xreboots.
- XDuring a long search, the SIGQUIT signal (CTRL-\\) causes \fIlast\fR to
- Xdisplay how far back it has gone; it then continues.
- X
- X
- X
- /
- echo x - leave
- sed '/^X/s///' > leave << '/'
- X.CD "leave \(en warn when it is time to go home"
- X.SX "leave\fR [\fR [\fB+\fR] \fIhh\fR[\fB:\fR]\fImm\fR]"
- X.FL "\fR(none)"
- X.EX "leave 1500" "Issue a warning at 2:55 p.m."
- X.EX "leave 10:00" "Issue a warning at 9:55 a.m."
- X.EX "leave + 30" "Issue a warning in 25 minutes"
- X.PP
- X\fILeave\fR sets an alarm clock to a specified time and issues a warning
- X5 minutes before, 1 minute before, and at the time to leave.
- XIt then keeps issuing warnings every minute for 10 minutes, then quits.
- XIf no time is provided, the program prompts for one.
- X
- X
- X
- X.SP -0.5
- /
- echo x - libpack
- sed '/^X/s///' > libpack << '/'
- X.CD "libpack \(en pack an ASCII assembly code file [IBM]"
- X.SX "libpack"
- X.FL "\fR(none)"
- X.EY "libpack <x.s >y.s" "Pack \fIx.s\fP"
- X.PP
- XThis program is a filter that reads an ASCII assembly code file from standard
- Xinput and writes the corresponding packed file on standard output.
- XThe compiler libraries are archives of packed assembly code files.
- X.SP -0.5
- X
- X
- X
- /
- echo x - libupack
- sed '/^X/s///' > libupack << '/'
- X.CD "libupack \(en convert a packed assembly code file to ASCII [IBM]"
- X.SX "libupack"
- X.FL "\fR(none)"
- X.EY "libupack <y.s >x.s" "Unpack \fIy.s\fP"
- X.PP
- XThis program is a filter that reads a packed assembly code file
- Xfrom \fIstdin\fR and writes the corresponding ASCII file on standard output.
- X
- X
- X
- /
- echo x - ln
- sed '/^X/s///' > ln << '/'
- X############ NEXT ENTRY HAS NOT BEEN CHECKED #############
- X.CD "ln \(en create a link to a file"
- X.SX "ln [\fB\(enf\fR] \fIfile\fR [\fIname\fR]
- X.SX "ln [\fB\(enf\fR] \fIfile\fR ... \fIdir\fR
- X.FL "\(enf" "Remove existing links"
- X.EX "ln file newname" "Make \fInewname\fP a synonym for \fIfile\fP"
- X.EX "ln /usr/games/chess" "Create a link called \fIchess\fP"
- X.PP
- XA directory entry is created for
- X.I name .
- XThe entry points to
- X.I file .
- XHenceforth,
- X.I name
- Xand
- X.I file
- Xcan be used interchangeably.
- XIf
- X.I name
- Xis not supplied, the last component of
- X.I file
- Xis used as the link name.
- XIf more than one
- X.I file
- Xis supplied or the
- X.I name
- Xrefers to an existing directory, links will be created in that directory.
- XAn existing
- X.I name
- Xwill not be removed unless the \fB\(enf\fR flag is specified.
- X
- X
- X
- /
- echo x - login
- sed '/^X/s///' > login << '/'
- X.CD "login \(en log into the computer"
- X.SX "login\fR [\fIuser\fR]"
- X.FL "\fR(none)"
- X.EY "login ast" "Login as ast"
- X.PP
- X\fILogin\fR allows a logged in user to login as someone else without first
- Xlogging out.
- XIf a password is needed, \fIlogin\fR will prompt for it.
- X
- X
- X
- X.SP 1.6
- /
- echo x - look
- sed '/^X/s///' > look << '/'
- X.CD "look \(en look up words in dictionary"
- X.SX "look\fR [\fB\(enf\fR] \fIprefix\fR[\fB/\fIsuffix\fR]\fR [\fIdictionary\fR]"
- X.FL "\(enf" "Fold upper case letters to lower case"
- X.EX "look ard" "Print words starting with \fIard\fR"
- X.EX "look /bing" "Print words ending with \fIbing\fR"
- X.EX "look \(enf f/ar" "Print words starting with \fIf\fR, ending with \fIar\fR"
- X.PP
- X\fILook\fR takes a prefix and/or suffix and searches \fI/usr/lib/dictionary\fR
- Xor the specified dictionary for all words with that match.
- XThe words are printed.
- XThe \fB\(enf\fR flag causes all upper case letters to be treated as lower
- Xcase.
- X
- X
- X
- X.SP 1.6
- /
- echo x - lorder
- sed '/^X/s///' > lorder << '/'
- X.CD "lorder \(en compute the order for library modules [IBM]"
- X.SX "lorder \fIfile ..."
- X.FL "\fR(none)"
- X.EY "lorder proc1.s proc2.s" "Give \fIlorder\fR information"
- X.PP
- X\fILorder\fR accepts a series of packed or unpacked \fI.s\fR files and
- Xlibraries, and produces a partial ordering suitable for processing by
- X\fItsort\fR.
- X
- X
- X
- /
- echo x - lpr
- sed '/^X/s///' > lpr << '/'
- X.CD "lpr \(en copy a file to the line printer"
- X.SX "lpr\fR [\fIfile\fR] ..."
- X.FL "\fR(none)"
- X.EX "lpr file &" "Print \fIfile\fP on the line printer"
- X.EX "pr file | lpr &" "Print \fIstdin\fR (\fIpr\fR's output)"
- X.PP
- XEach argument is interpreted as a file to be printed.
- X.I Lpr
- Xcopies each file to
- X.I /dev/lp ,
- Xwithout spooling.
- XIt inserts carriage returns and expands tabs.
- XOnly one
- X.I lpr
- Xat a time may be running.
- X
- X
- X
- X.SP 1
- /
- echo x - ls
- sed '/^X/s///' > ls << '/'
- X.CD "ls \(en list the contents of a directory"
- X.SX "ls\fR [\fB\(enabcdfgilmnopqrstux01ACFLRS\fR]\fR [\fIname\fR] ...
- X.FL "\(enA" "All entries are listed, except \fI.\fR and \fI..\fR"
- X.FL "\(enC" "Multicolumn listing with entries sorted down the page"
- X.FL "\(enF" "Put /, | and * after directories, fifos and executables"
- X.FL "\(enL" "Print information about symbolic links"
- X.FL "\(enR" "Recursively list subdirectories"
- X.FL "\(enS" "Squeeze column widths in multicolumn listings"
- X.FL "\(ena" "List all entries including those starting with \fI.\fR"
- X.FL "\(enb" "Print non-graphic characters in octal \\ddd notation"
- X.FL "\(enc" "Use the status change time instead of modification time"
- X.FL "\(end" "Do not list contents of directories"
- X.FL "\(enf" "List argument as unsorted directory"
- X.FL "\(eng" "As for \(enl, but print the group only"
- X.FL "\(eni" "I-node number printed in first column"
- X.FL "\(enl" "Long listing: mode, links, owner, group, size and time"
- X.FL "\(enm" "Stream output format"
- X.FL "\(enn" "As for \(enl, but print numeric uid and gid"
- X.FL "\(eno" "As for \(enl, but print the owner only"
- X.FL "\(enp" "Put / after directory names"
- X.FL "\(enq" "Print ? in place of non-graphic characters"
- X.FL "\(enr" "Reverse the sort order"
- X.FL "\(ens" "Print the size in 512 byte units"
- X.FL "\(ent" "Sort by time, latest first"
- X.FL "\(enu" "Use last usage time instead of modification time"
- X.FL "\(enx" "Multicolumn listing with entries sorted across the page"
- X.FL "\(en0" "Reset all options"
- X.FL "\(en1" "Print one entry per line (default)"
- X.EX "ls \(enl~~" "List files in working directory"
- X.EX "ls \(enlis" "List with i-nodes and sizes"
- XFor each file argument, list it.
- XFor each directory argument, list its contents, unless \fB\(end\fR is present.
- XWhen no argument is present, the working directory is listed.
- /
-