xref: /titanic_50/usr/src/man/man1/man.1 (revision 4185ca1d7f22b7d0d04eac3b580dd338274cb432)
1.\"
2.\" The Berkeley software License Agreement specifies the terms and conditions
3.\" for redistribution.
4.\"
5.\"
6.\" Copyright (c) 1980 Regents of the University of California.
7.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
8.\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
9.\" Copyright 2016 Nexenta Systems, Inc.
10.\"
11.Dd February 12, 2016
12.Dt MAN 1
13.Os
14.Sh NAME
15.Nm man
16.Nd find and display reference manual pages
17.Sh SYNOPSIS
18.Nm
19.Op Fl
20.Op Fl adFlrt
21.Op Fl T Ar macro-package
22.Op Fl M Ar path
23.Op Fl s Ar section
24.Ar name ...
25.Nm
26.Op Fl M Ar path
27.Op Fl s Ar section
28.Fl k
29.Ar keyword
30.Ar ...
31.Nm
32.Op Fl M Ar path
33.Op Fl s Ar section
34.Fl f
35.Ar
36.Nm
37.Op Fl M Ar path
38.Fl w
39.Sh DESCRIPTION
40The
41.Nm
42command displays information from the reference manuals. It
43displays complete manual pages that you select by
44.Ar name ,
45or one-line summaries selected either by
46.Ar keyword
47.Pq Fl k ,
48or by the name of an associated file
49.Pq Fl f .
50If no manual page is located,
51.Nm
52prints an error message.
53.Ss "Source Format"
54Reference Manual pages are marked up with either
55.Xr man 5 ,
56or
57.Xr mdoc 5
58language tags. The
59.Nm
60command recognizes the type of markup and
61processes the file accordingly.
62.
63.Ss "Location of Manual Pages"
64.
65The online Reference Manual page directories are conventionally located in
66.Pa /usr/share/man .
67Each directory corresponds to a
68section of the manual. Since these directories are optionally installed, they
69might not reside on your host. You might have to mount
70.Pa /usr/share/man
71from a host on which they do reside.
72The
73.Nm
74command reformats a page whenever it is requested.
75.Pp
76If the standard output is not a terminal, or if the
77.Fl
78flag is given,
79.Nm
80pipes its output through
81.Xr cat 1 .
82Otherwise,
83.Nm
84pipes its output through a pager such as
85.Xr more 1
86to handle paging and underlining on the screen.
87.Sh OPTIONS
88The following options are supported:
89.Bl -tag -width indent
90.It Fl a
91Shows all manual pages matching
92.Ar name
93within the
94.Ev MANPATH
95search path. Manual pages are displayed in the order found.
96.It Fl d
97Debugs. Displays what a section-specifier evaluates to, method used for
98searching, and paths searched by
99.Nm .
100.It Fl f Ar file ...
101Attempts to locate manual pages related to any of the given
102.Ar file
103names. It strips the leading path name components from each
104.Ar file ,
105and then prints one-line summaries containing the resulting basename or names.
106This option also uses the
107.Pa whatis
108database.
109.It Fl F
110This option is present for backwards compatibility and is documented
111here for reference only.  It performs no function.
112.It Fl k Ar keyword ...
113Prints out one-line summaries from the
114.Pa whatis
115database (table of contents) that contain any of the given
116.Ar keyword .
117The
118.Pa whatis
119database is created using the
120.Fl w
121option.
122.It Fl l
123Lists all manual pages found matching
124.Ar name
125within the search path.
126.It Fl M Ar path
127Specifies an alternate search path for manual pages. The
128.Ar path
129is a colon-separated list of directories that contain manual page directory
130subtrees. For example, if
131.Ar path
132is
133.Pa /usr/share/man:/usr/local/man ,
134.Nm
135searches for
136.Ar name
137in the standard location, and then
138.Pa /usr/local/man .
139When used with the
140.Fl k ,
141.Fl f ,
142or
143.Fl w
144options, the
145.Fl M
146option must appear first. Each directory in the
147.Ar path
148is assumed to contain subdirectories of the form
149.Pa man* ,
150one for each section. This option overrides the
151.Ev MANPATH
152environment variable.
153.It Fl r
154Reformats the manual page, checking for formatting errors, but does not
155display it.
156.It Fl s Ar section
157Specifies sections of the manual for
158.Nm
159to search. The directories searched for
160.Ar name
161are limited to those specified by
162.Ar section .
163.Ar section
164can be a numerical digit, perhaps followed by one or more letters
165to match the desired section of the manual, for example,
166.Li "3libucb".
167Also,
168.Ar section
169can be a word, for example,
170.Li local ,
171.Li new ,
172.Li old ,
173.Li public .
174.Ar section
175can also be a letter. To specify multiple sections,
176separate each section with a comma. This option overrides the
177.Ev MANPATH
178environment variable and the
179.Pa man.cf
180file. See
181.Sx Search Path
182below for an explanation of how
183.Nm
184conducts its search.
185.It Fl t
186Arranges for the specified manual pages to be sent to the default
187printer as PostScript.
188.It Fl T Ar macro-package
189This option is present for backwards compatibility and is documented
190here for reference only.  It performs no function.
191.It Fl w
192Updates the
193.Nm whatis
194database.
195.El
196.Sh OPERANDS
197The following operand is supported:
198.Bl -tag -width indent
199.It Ar name
200The name of a standard utility or a keyword.
201.El
202.Sh USAGE
203The usage of
204.Nm
205is described below:
206.
207.Ss "Manual Page Sections"
208.
209Entries in the reference manuals are organized into
210.Em sections .
211A section
212name consists of a major section name, typically a single digit, optionally
213followed by a subsection name, typically one or more letters. An unadorned
214major section name, for example,
215.Qq 9 ,
216does not act as an abbreviation for
217the subsections of that name, such as
218.Qq 9e ,
219.Qq 9f ,
220or
221.Qq 9s .
222That is, each subsection must be searched separately by
223.Nm
224.Fl s .
225Each section contains descriptions apropos to a particular reference category,
226with subsections refining these distinctions. See the
227.Em intro
228manual pages for an explanation of the classification used in this release.
229.
230.Ss "Search Path"
231.
232Before searching for a given
233.Ar name ,
234.Nm
235constructs a list of candidate directories and sections.
236It searches for
237.Ar name
238in the directories specified by the
239.Ev MANPATH
240environment variable.
241.Lp
242In the absence of
243.Ev MANPATH ,
244.Nm
245constructs its search path based upon the
246.Ev PATH
247environment variable, primarily by substituting
248.Li man
249for the last component of the
250.Ev PATH
251element. Special provisions are added
252to account for unique characteristics of directories such as
253.Pa /sbin ,
254.Pa /usr/ucb ,
255.Pa /usr/xpg4/bin ,
256and others. If the file argument contains
257a
258.Qq /
259character, the
260.Em dirname
261portion of the argument is used in place of
262.Ev PATH
263elements to construct the search path.
264.Lp
265Within the manual page directories,
266.Nm
267confines its search to the
268sections specified in the following order:
269.Bl -bullet
270.It
271.Ar sections
272specified on the command line with the
273.Fl s
274option
275.It
276.Ar sections
277embedded in the
278.Ev MANPATH
279environment variable
280.It
281.Ar sections
282specified in the
283.Pa man.cf
284file for each directory specified in the
285.Ev MANPATH
286environment variable
287.El
288If none of the above exist,
289.Nm
290searches each directory in the manual
291page path, and displays the first matching manual page found.
292.Lp
293The
294.Pa man.cf
295file has the following format:
296.Lp
297.Dl Pf MANSECTS= Ar section Ns Oo , Ns Ar section Oc Ns ...
298.Lp
299Lines beginning with
300.Sq Li #
301and blank lines are considered comments, and are
302ignored. Each directory specified in
303.Ev MANPATH
304can contain a manual page
305configuration file, specifying the default search order for that directory.
306.Sh "Referring to Other Manual Pages"
307If the first line of the manual page is a reference to another manual
308page entry fitting the pattern:
309.Lp
310.Dl \&.so man*/ Ns Em sourcefile
311.Lp
312.Nm
313processes the indicated file in place of the current one. The
314reference must be expressed as a path name relative to the root of the manual
315page directory subtree.
316.Lp
317When the second or any subsequent line starts with
318.Sy \&.so ,
319.Nm
320ignores it;
321.Xr troff 1
322or
323.Xr nroff 1
324processes the request in the usual manner.
325.Sh ENVIRONMENT VARIABLES
326See
327.Xr environ 5
328for descriptions of the following environment variables
329that affect the execution of
330.Nm man :
331.Ev LANG ,
332.Ev LC_ALL ,
333.Ev LC_CTYPE ,
334.Ev LC_MESSAGES ,
335and
336.Ev NLSPATH .
337.Bl -tag -width MANWIDTH
338.It Ev MANPATH
339A colon-separated list of directories; each directory can be followed by a
340comma-separated list of sections. If set, its value overrides
341.Pa /usr/share/man
342as the default directory search path, and the
343.Pa man.cf
344file as the default section search path. The
345.Fl M
346and
347.Fl s
348flags, in turn, override these values.
349.It Ev MANWIDTH
350Width of the output. If set to the special value
351.Qq Sy TTY
352.Po or
353.Qq Sy tty
354.Pc ,
355and output is to terminal, auto-detect terminal width.
356.It Ev PAGER
357A program to use for interactively delivering
358output to the screen. If not set,
359.Sq Nm more Fl s
360is used. See
361.Xr more 1 .
362.El
363.Sh FILES
364.Bl -tag -width indent
365.It Pa /usr/share/man
366Root of the standard manual page directory subtree
367.It Pa /usr/share/man/man?/*
368Unformatted manual entries
369.It Pa /usr/share/man/whatis
370Table of contents and keyword database
371.It Pa man.cf
372Default search order by section
373.El
374.Sh EXIT STATUS
375.Ex -std man
376.Sh EXAMPLES
377.
378.Ss Example 1: Creating a PostScript Version of a man page
379.
380The following example spools the
381.Xr pipe 2
382man page in PostScript to the default printer:
383.Pp
384.Dl % man -t -s 2 pipe
385.Pp
386Note that
387.Xr mandoc 1
388can be used to obtain the PostScript content directly.
389.Ss Example 2: Creating a Text Version of a man page
390The following example creates the
391.Xr pipe 2
392man page in ASCII text:
393.Pp
394.Dl % man pipe.2 | col -x -b > pipe.text
395.Sh CODE SET INDEPENDENCE
396Enabled.
397.Sh INTERFACE STABILITY
398.Sy Committed .
399.Sh SEE ALSO
400.Xr apropos 1 ,
401.Xr cat 1 ,
402.Xr col 1 ,
403.Xr mandoc 1 ,
404.Xr more 1 ,
405.Xr whatis 1 ,
406.Xr environ 5 ,
407.Xr man 5 ,
408.Xr mdoc 5
409.Sh NOTES
410The
411.Fl f
412and
413.Fl k
414options use the
415.Nm whatis
416database, which is
417created with the
418.Fl w
419option.
420.Sh BUGS
421The manual is supposed to be reproducible either on a phototypesetter or on an
422ASCII terminal. However, on a terminal some information (indicated by
423font changes, for instance) is lost.
424