xref: /freebsd/usr.bin/man/man.1 (revision 3877025f52ee205fe99ad4ff68229933d57e4bcb)
1.\"-
2.\" SPDX-License-Identifier: BSD-2-Clause
3.\"
4.\"  Copyright (c) 2010 Gordon Tetlow
5.\"  All rights reserved.
6.\"
7.\"  Redistribution and use in source and binary forms, with or without
8.\"  modification, are permitted provided that the following conditions
9.\"  are met:
10.\"  1. Redistributions of source code must retain the above copyright
11.\"     notice, this list of conditions and the following disclaimer.
12.\"  2. Redistributions in binary form must reproduce the above copyright
13.\"     notice, this list of conditions and the following disclaimer in the
14.\"     documentation and/or other materials provided with the distribution.
15.\"
16.\"  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17.\"  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\"  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\"  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20.\"  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\"  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\"  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\"  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\"  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\"  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\"  SUCH DAMAGE.
27.\"
28.Dd January 24, 2025
29.Dt MAN 1
30.Os
31.Sh NAME
32.Nm man
33.Nd display online manual documentation pages
34.Sh SYNOPSIS
35.Nm
36.Op Fl adhlo
37.Op Fl t | w
38.Op Fl M Ar manpath
39.Op Fl P Ar pager
40.Op Fl S Ar mansect
41.Op Fl m Ar arch Ns Op : Ns Ar machine
42.Op Fl p Op Ar eprtv
43.Op Ar mansect
44.Ar page | Ar
45.Nm
46.Fl K | f | k
47.Ar expression ...
48.Sh DESCRIPTION
49The
50.Nm
51utility finds and displays online manual documentation pages.
52If
53.Ar mansect
54is provided,
55.Nm
56restricts the search to the specific section of the manual.
57.Pp
58The sections of the manual are:
59.Pp
60.Bl -enum -offset indent -compact
61.It
62.Fx
63General Commands Manual
64.It
65.Fx
66System Calls Manual
67.It
68.Fx
69Library Functions Manual
70.It
71.Fx
72Kernel Interfaces Manual
73.It
74.Fx
75File Formats Manual
76.It
77.Fx
78Games Manual
79.It
80.Fx
81Miscellaneous Information Manual
82.It
83.Fx
84System Manager's Manual
85.It
86.Fx
87Kernel Developer's Manual
88.El
89.Pp
90Options that
91.Nm
92understands:
93.Bl -tag -width indent
94.It Fl K Ar expression
95Search full text of all manual pages for an extended regular
96.Ar expression ,
97as described in
98.Xr re_format 7 .
99This option requires
100.Xr mandoc 1 .
101This is a slow operation.
102.It Fl M Ar manpath
103Force a specific colon separated manual path instead of the default
104search path.
105See
106.Ev MANPATH
107in
108.Sx ENVIRONMENT .
109.It Fl P Ar pager
110Use specified pager.
111Defaults to
112.Ql less -sR
113if color support is enabled, or
114.Ql less -s .
115Overrides the
116.Ev MANPAGER
117environment variable, which in turn overrides the
118.Ev PAGER
119environment variable.
120.It Fl S Ar mansect
121Restrict manual sections searched to the specified colon delimited list.
122Defaults to
123.Ql 1:8:2:3:3lua:n:4:5:6:7:9:l .
124Overrides the
125.Ev MANSECT
126environment variable.
127.It Fl a
128Display all manual pages instead of just the first found for each
129.Ar page
130argument.
131.It Fl d
132Print extra debugging information.
133Repeat for increased verbosity.
134Does not display the manual page.
135.It Fl f Ar expression
136Search names of all manual pages for an extended regular
137.Ar expression ,
138emulating
139.Xr whatis 1 .
140.It Fl h
141Display short help message and exit.
142.It Fl k Ar expression
143Search names and descriptions of all manual pages for an extended regular
144.Ar expression ,
145emulating basic functionality of
146.Xr apropos 1 .
147.It Fl l
148Interpret all arguments as absolute or relative filename(s)
149of the manual page(s) to display.
150No search is done and the options
151.Fl M ,
152.Fl m ,
153and
154.Fl S
155are ignored.
156.It Fl m Ar arch Ns Op : Ns Ar machine
157Override the default architecture and machine settings allowing lookup of
158other platform specific manual pages.
159See
160.Sx IMPLEMENTATION NOTES
161for how this option changes the default behavior.
162Overrides the
163.Ev MACHINE_ARCH
164and
165.Ev MACHINE
166environment variables.
167.It Fl o
168Force use of non-localized manual pages.
169See
170.Sx IMPLEMENTATION NOTES
171for how locale specific searches work.
172Overrides the
173.Ev LC_ALL , LC_CTYPE ,
174and
175.Ev LANG
176environment variables.
177.It Fl p Op Cm eprtv
178Use the list of given preprocessors before running
179.Xr nroff 1 Pq Pa ports/textproc/groff
180or
181.Xr troff 1 Pq Pa ports/textproc/groff .
182Valid preprocessors arguments:
183.Pp
184.Bl -tag -width indent -compact
185.It Cm e
186.Xr eqn 1 Pq Pa ports/textproc/groff
187.It Cm p
188.Xr pic 1 Pq Pa ports/textproc/groff
189.It Cm r
190.Xr refer 1 Pq Pa ports/textproc/groff
191.It Cm t
192.Xr tbl 1 Pq Pa ports/textproc/groff
193.It Cm v
194.Xr vgrind 1
195.El
196.Pp
197Overrides the
198.Ev MANROFFSEQ
199environment variable.
200.It Fl t
201Send manual page source through
202.Xr troff 1 Pq Pa ports/textproc/groff
203allowing transformation of the manual pages to other formats.
204.It Fl w
205Display the location of the manual page instead of the contents of
206the manual page.
207.El
208.Sh IMPLEMENTATION NOTES
209.Ss Locale Specific Searches
210The
211.Nm
212utility supports manual pages in different locales.
213The search behavior is dictated by the first of three
214environment variables with a nonempty string:
215.Ev LC_ALL , LC_CTYPE ,
216or
217.Ev LANG .
218If set,
219.Nm
220will search for locale specific manual pages using the following logic:
221.Pp
222.Bl -item -offset indent -compact
223.It
224.Va lang Ns _ Ns Va country . Ns Va charset
225.It
226.Va lang . Ns Va charset
227.It
228.Li en . Ns Va charset
229.El
230.Pp
231For example, if
232.Ev LC_ALL
233is set to
234.Ql ja_JP.eucJP ,
235.Nm
236will search the following paths when considering section 1 manual pages in
237.Pa /usr/share/man :
238.Pp
239.Bl -item -offset indent -compact
240.It
241.Pa /usr/share/man/ja_JP.eucJP/man1
242.It
243.Pa /usr/share/man/ja.eucJP/man1
244.It
245.Pa /usr/share/man/en.eucJP/man1
246.It
247.Pa /usr/share/man/man1
248.El
249.Ss Platform Specific Searches
250The
251.Nm
252utility supports platform specific manual pages.
253The search behavior is dictated by the
254.Fl m
255option or the
256.Ev MACHINE_ARCH
257and
258.Ev MACHINE
259environment variables.
260For example, if
261.Ev MACHINE_ARCH
262is set to
263.Ql aarch64
264and
265.Ev MACHINE
266is set to
267.Ql arm64 ,
268.Nm
269will search the following paths when considering section 4 manual pages in
270.Pa /usr/share/man :
271.Pp
272.Bl -item -offset indent -compact
273.It
274.Pa /usr/share/man/man4/aarch64
275.It
276.Pa /usr/share/man/man4/arm64
277.It
278.Pa /usr/share/man/man4
279.El
280.Ss Displaying Specific Manual Files
281For compatibility reasons,
282.Nm
283will interpret any argument containing at least one
284.Ql /
285character as an absolute or relative path to a manual page to be
286displayed.
287This heuristic, made redundant by the more widely supported
288.Fl l
289option, is now deprecated and may be removed in future releases.
290.Sh ENVIRONMENT
291The following environment variables affect the execution of
292.Nm :
293.Bl -tag -width indent
294.It Ev LC_ALL , Ev LC_CTYPE , Ev LANG
295Used to find locale specific manual pages.
296Valid values can be found by running the
297.Xr locale 1
298command.
299See
300.Sx IMPLEMENTATION NOTES
301for details.
302Influenced by the
303.Fl o
304option.
305.It Ev MACHINE_ARCH , Ev MACHINE
306Used to find platform specific manual pages.
307If unset, the output of
308.Ql sysctl Va hw.machine_arch
309and
310.Ql sysctl Va hw.machine
311is used respectively.
312See
313.Sx IMPLEMENTATION NOTES
314for details.
315Corresponds to the
316.Fl m
317option.
318.It Ev MANPATH
319A colon
320.Pq Ql \&:
321separated list of directories to check for manual pages.
322Invalid paths, or paths without manual databases, are ignored.
323Overridden by
324.Fl M .
325If
326.Ev MANPATH
327begins with a colon, it is appended to the default list;
328if it ends with a colon, it is prepended to the default list;
329or if it contains two adjacent colons,
330the standard search path is inserted between the colons.
331If none of these conditions are met, it overrides the
332standard search path.
333See
334.Xr manpath 1 .
335.It Ev MANROFFSEQ
336Used to determine the preprocessors for the manual source before running
337.Xr nroff 1 Pq Pa ports/textproc/groff
338or
339.Xr troff 1 Pq Pa ports/textproc/groff .
340If unset, defaults to
341.Xr tbl 1 Pq Pa ports/textproc/groff .
342Corresponds to the
343.Fl p
344option.
345.It Ev MANSECT
346Restricts manual sections searched to the specified colon delimited list.
347Corresponds to the
348.Fl S
349option.
350.It Ev MANWIDTH
351If set to a numeric value, used as the width manpages should be displayed.
352Otherwise, if set to a special value
353.Ql tty ,
354and output is to a terminal,
355the pages may be displayed over the whole width of the screen.
356.It Ev MANCOLOR
357If set, enables color support.
358.It Ev MANPAGER
359Program used to display files.
360.Pp
361If unset, and color support is enabled,
362.Ql less -sR
363is used.
364.Pp
365If unset, and color support is disabled, then
366.Ev PAGER
367is used.
368If that has no value either,
369.Ql less -s
370is used.
371.El
372.Sh FILES
373.Bl -tag -width "/usr/local/etc/man.d/*.conf" -compact
374.It Pa /etc/man.conf
375System configuration file
376.It Pa /usr/local/etc/man.d/*.conf
377Local configuration files
378.El
379.Sh EXIT STATUS
380.Ex -std
381.Sh EXAMPLES
382Show the manual page for
383.Xr stat 2 :
384.Pp
385.Dl $ man 2 stat
386.Pp
387Show all manual pages for
388.Ql stat :
389.Pp
390.Dl $ man -a stat
391.Pp
392List manual pages which match the regular expression either in the title or in
393the body:
394.Pp
395.Dl $ man -k '\e<copy\e>.*archive'
396.Pp
397Show the manual page for
398.Xr ls 1
399using
400.Xr cat 1
401as the pager:
402.Pp
403.Dl $ man -P cat ls
404.Pp
405Show the location of the
406.Xr ls 1
407manual page:
408.Pp
409.Dl $ man -w ls
410.Pp
411Show a manual page in the current working directory:
412.Pp
413.Dl $ man -l man.1
414.Pp
415Show the location of manual pages in sections 1 and 8 which contain the word
416.Ql arm :
417.Pp
418.Dl $ man -w -K '\e<arm\e>' -S 1:8
419.Sh SEE ALSO
420.Xr apropos 1 ,
421.Xr intro 1 ,
422.Xr mandoc 1 ,
423.Xr manpath 1 ,
424.Xr whatis 1 ,
425.Xr intro 2 ,
426.Xr intro 3 ,
427.Xr intro 3lua ,
428.Xr intro 4 ,
429.Xr intro 5 ,
430.Xr man.conf 5 ,
431.Xr intro 6 ,
432.Xr intro 7 ,
433.Xr mdoc 7 ,
434.Xr re_format 7 ,
435.Xr intro 8 ,
436.Xr intro 9
437