Unix Programmer 39;s Manual Volume 1

0 views
Skip to first unread message

Penny Bozic

unread,
Aug 3, 2024, 1:09:25 PM8/3/24
to cunurguibi

A man page (short for manual page) is a form of software documentation usually found on a Unix or Unix-like operating system. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts. A user may invoke a man page by issuing the man command.

Man pages are often referred to as an on-line or online form of software documentation,[1] even though the man command does not require internet access, dating back to the times when printed out-of-band manuals were the norm.

Before Unix (e.g., GCOS), documentation was printed pages, available on the premises to users (staff, students...), organized into steel binders, locked together in one monolithic steel reading rack, bolted to a table or counter, with pages organized for modular information updates, replacement, errata, and addenda. [citation needed]

In the first two years of the history of Unix, no documentation existed.[2] The Unix Programmer's Manual was first published on November 3, 1971. The first actual man pages were written by Dennis Ritchie and Ken Thompson at the insistence[citation needed] of their manager Doug McIlroy in 1971. Aside from the man pages, the Programmer's Manual also accumulated a set of short papers, some of them tutorials (e.g. for general Unix usage, the C programming language, and tools such as Yacc), and others more detailed descriptions of operating system features. The printed version of the manual initially fit into a single binder, but as of PWB/UNIX and the 7th Edition of Research Unix, it was split into two volumes with the printed man pages forming Volume 1.[3]

Later versions of the documentation imitated the first man pages' terseness. Ritchie added a "How to get started" section to the Third Edition introduction, and Lorinda Cherry provided the "Purple Card" pocket reference for the Sixth and Seventh Editions.[2] Versions of the software were named after the revision of the manual; the seventh edition of the Unix Programmer's Manual, for example, came with the 7th Edition or Version 7 of Unix.[4]

For the Fourth Edition the man pages were formatted using the troff typesetting package[2] and its set of -man macros (which were completely revised between the Sixth and Seventh Editions of the Manual,[3] but have since not drastically changed). At the time, the availability of online documentation through the manual page system was regarded as a great advance. To this day, virtually every Unix command line application comes with a man page, and many Unix users perceive a program's lack of man pages as a sign of low quality; indeed, some projects, such as Debian, go out of their way to write man pages for programs lacking one. The modern descendants of 4.4BSD also distribute man pages as one of the primary forms of system documentation (having replaced the old -man macros with the newer -mdoc).

There was a hidden Easter egg in the man-db version of the man command that would cause the command to return "gimme gimme gimme" when run at 00:30 (a reference to the ABBA song Gimme! Gimme! Gimme! (A Man After Midnight). It was introduced in 2011[5] but first restricted[6] and then removed in 2017[7] after finally being found.[8]

The default format of man pages is troff, with either the macro package man (appearance oriented) or mdoc (semantic oriented). This makes it possible to typeset a man page into PostScript, PDF, and various other formats for viewing or printing.

Some Unix systems have a package for the man2html command, which enables users to browse their man pages using an HTML browser. Systems with groff and man-db should use the higher-quality native HTML output (man --html) instead.The GNU Emacs program WoMan (from "WithOut man") allows to browse man pages from the editor.[9]

In 2010, OpenBSD deprecated troff for formatting man pages in favour of mandoc, a specialised compiler/formatter for man pages with native support for output in PostScript, HTML, XHTML, and the terminal. It is meant to only support a subset of troff used in manual pages, specifically those using mdoc macros.

In February 2013, the BSD community saw a new open source mdoc.su service launched, which unified and shortened access to the man.cgi scripts of the major modern BSD projects through a unique nginx-based deterministic URL shortening service for the *BSD man pages.[10][11][12]

Pages are traditionally referred to using the notation "name(section)": for example, ftp(1). The section refers to different ways the topic might be referenced - for example, as a system call, or a shell (command line) command or package, or a package's configuration file, or as a coding construct / header.

The same page name may appear in more than one section of the manual, such as when the names of system calls, user commands, or macro packages coincide. Examples are man(1) and man(7), or exit(2) and exit(3). The syntax for accessing the non-default manual section varies between different man implementations.

The manual is generally split into eight numbered sections. Most systems today (e.g. BSD,[15] macOS, Linux,[16] and Solaris 11.4) inherit the numbering scheme used by Research Unix.[17][18] While System V uses a different order:[19]

Some sections are further subdivided by means of a suffix; for example, in some systems, section 3C is for C library calls, 3M is for the math library, and so on. A consequence of this is that section 8 (system administration commands) is sometimes relegated to the 1M subsection of the main commands section. Some subsection suffixes have a general meaning across sections:

Other sections may be present, but these are not well standardized across man pages. Common examples include: OPTIONS, EXIT STATUS, RETURN VALUE, ENVIRONMENT, BUGS, FILES, AUTHOR, REPORTING BUGS, HISTORY and COPYRIGHT.

Manual pages can be written either in the old man macros, the new doc macros, or a combination of both (mandoc).[22] The man macro set provides minimal rich text functions, with directives for the title line, section headers, (bold, small or italic) fonts, paragraphs and adding/reducing indentation.[23] The newer mdoc language is more semantic in nature, and contains specialized macros for most standard sections such as program name, synopsis, function names, and the name of the authors. This information can be used to implement a semantic search for manuals by programs such as mandoc. Although it also includes directives to directly control the styling, it is expected that the specialized macros will cover most of the use-cases.[21] Both the mandoc and the groff projects consider mdoc the preferred format for new documents.[24]

Although man pages are, to troff, text laid out using 10-point Roman type, this distinction is usually moot because man pages are viewed in the terminal (TTY) instead of laid out on paper. As a result, the "small font" macro is seldom used.[25] On the other hand, bold and italic text is supported by the terminal via ECMA-48, and groff's grotty does emit them as requested when it detects a supporting terminal. The BSD mandoc however only supports bold and underlined (as a replacement for italics) text via the typewriter backspace-then-overstrike sequence, which needs to be translated into ECMA-48 by less.[26][27]

Few alternatives to man have enjoyed much popularity, with the possible exception of GNU Project's "info" system, an early and simple hypertext system. There is also a third-party effort known as TLDR pages (tldr) that provides simple examples for common use cases, similar to a cheatsheet.[32]

In addition, some Unix GUI applications (particularly those built using the GNOME and KDE development environments) now provide end-user documentation in HTML and include embedded HTML viewers such as yelp for reading the help within the application. An HTML system in Emacs is also slated to replace texinfo.[33]

The manual pages and tools for building the manual were unearthed by the late Dennis Ritchie, and made available through the The Unix Heritage Society on January 2000. The consist of two shell scripts and about 14,121 lines of troff markup text. I modernized the old shell scripts and corrected some minor markup glitches through commits that are recorded in a GitHub repository.

The process of working with 44-year artefacts was surprisingly smooth. The scripts for generating the table of contents and the permuted index are based on the original ones. The changes I did in the scripts involved the following.

I wrote from scratch a script to typeset everything into one volume. I could not find a shell script for typesetting the whole manual in any of the Research Editions. I assume the process of running the typesetter was so cumbersome, error prone, and time-consuming that it was manually performed on a page-by-page basis.

Here you can find the manual in PDF format. As is the case with all the original Unix documentation, its quality in terms of conciseness, completeness, and rigour remains unsurpassed until today. If you search, you can even find nuggets of humour, as in the Bugs section of the tmheader - Technical Memorandum cover sheet command: God help you on two-page abstracts. Try to write less.

The many accounts available on the Internet lack citations and are at times inconsistent.In this article, I reconstruct the history of the UNIX manpage based on source code, manuals, and first-hand accounts.

Special thanks to Paul Pierce for his CTSS source archive; Bernard Nivelet for theMultics InternetServer; the UNIX Heritage Society for their research UNIX source reconstruction; Gunnar Ritter for the Heirloom Project sources; Alcatel-Lucent Bell Labs for the Plan 9 sources; BitSavers for their historical archive; and last but not least, Rudd Canaday, JamesClark, Brian Kernighan, Douglas McIlroy, Nils-Peter Nelson, Jerome Saltzer, Henry Spencer, Ken Thompson, and Tom VanVleck for their valuable contributions.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages