xref: /netbsd-src/usr.bin/man/man.1 (revision 524ac00571d2a4e3b6fb74a31388c5b64e5eebd0)
1.\"	$NetBSD: man.1,v 1.31 2024/11/29 07:55:10 lukem Exp $
2.\"
3.\" Copyright (c) 1989, 1990, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"     @(#)man.1	8.2 (Berkeley) 1/2/94
31.\"
32.Dd November 29, 2024
33.Dt MAN 1
34.Os
35.Sh NAME
36.Nm man
37.Nd display the on-line manual pages
38.Pq aka Dq Em man pages
39.Sh SYNOPSIS
40.Nm
41.Oo Fl acw Ns \&| Ns Fl h Oc
42.Op Fl C Ar file
43.Op Fl M Ar path
44.Op Fl m Ar path
45.Op Fl S Ar srch
46.Oo
47.Op Fl s
48.Ar section
49.Oc
50.Ar name Ar \&...
51.Nm
52.Op Fl C Ar file
53.Fl f Ar command
54.Ar \&...
55.Nm
56.Op Fl C Ar file
57.Fl k Ar keyword
58.Ar \&...
59.Nm
60.Fl p
61.Sh DESCRIPTION
62The
63.Nm
64utility displays the manual pages named on the command line.
65Its options are as follows:
66.Bl -tag -width Fl
67.It Fl a
68Display all of the man pages for a specified
69.Ar section
70and
71.Ar name
72combination.
73(Normally, only the first man page found is displayed.)
74.It Fl C Ar file
75Use the specified
76.Ar file
77instead of the default configuration file.
78This permits users to configure their own man environment.
79See
80.Xr man.conf 5
81for a description of the contents of this file.
82.It Fl c
83Copy the man page to the standard output instead of using
84.Xr more 1
85to paginate it.
86This is done by default if the standard output is not a terminal device.
87.It Fl f Ar command
88Synonym for
89.Xr whatis 1 .
90It searches man pages for
91.Ar command
92in their names and displays header lines from all matching pages.
93.It Fl h
94Display only the
95.Dq Tn SYNOPSIS
96lines of the requested man pages.
97For commands, this is typically the command line usage information.
98For library functions, this usually contains the required include
99files and function prototypes.
100.It Fl k Ar keyword
101Search man pages for
102.Ar keyword Ns Pq s ,
103in the same manner as
104.Xr apropos 1 .
105.It Fl M Ar path
106Override the list of standard directories which
107.Nm
108searches for man pages.
109The supplied
110.Ar path
111must be a colon
112.Pq Dq \&:
113separated list of directories.
114This search path may also be set using the environment variable
115.Ev MANPATH .
116The subdirectories to be searched, and their search order,
117is specified by the
118.Dq _subdir
119line in the
120.Nm
121configuration file.
122.It Fl m Ar path
123Augment the list of standard directories which
124.Nm
125searches for man pages.
126The supplied
127.Ar path
128must be a colon
129.Pq Dq \&:
130separated list of directories.
131These directories will be searched before the standard directories or
132the directories specified using the
133.Fl M
134option or the
135.Ev MANPATH
136environment variable.
137The subdirectories to be searched, and their search order,
138is specified by the
139.Dq _subdir
140line in the
141.Nm
142configuration file.
143.It Fl p
144Print the search path for the manual pages.
145.It Fl s Ar section
146Restrict the directories that
147.Nm
148will search to the specified
149.Ar section .
150The
151.Nm
152configuration file (see
153.Xr man.conf 5 )
154specifies the possible
155.Ar section
156values that are currently available.
157.It Fl S Ar srch
158Display only man pages that have the specified string
159.Ar srch
160in the directory part of their filenames.
161This allows the man page search process criteria to be
162narrowed without having to change the MANPATH or
163.Dq _default
164variables.
165.It Fl w
166List the pathnames of the man pages which
167.Nm
168would display for the specified
169.Ar section
170and
171.Ar name
172combination.
173.El
174.Pp
175If the
176.Ql Fl s
177option is not specified,
178there is more than one argument,
179the
180.Ql Fl k
181option is not used, and the first argument is a valid section, then that
182argument will be used as if specified by the
183.Ql Fl s
184option.
185.Pp
186If
187.Ar name
188is given with a full path (beginning with
189.Ql Pa \&/ )
190or a relative path that begins with
191.Ql Pa .\&/
192or
193.Ql Pa .\&./ ,
194then
195.Nm
196interprets it as a file specification, so that you can do
197.Nm
198.Cm ./foo.5
199or even
200.Nm
201.Cm /cd/foo/bar.1.gz .
202If
203.Ar name
204contains
205.Ql Pa /
206but does not match one of the above cases, then the
207search path is used; this allows you to request
208machine-specific man pages, such as
209.Nm Cm vax/boot .
210.Sh ENVIRONMENT
211.Bl -tag -width MANPATHX
212.It Ev MACHINE
213As some man pages are intended only for specific architectures,
214.Nm
215searches any subdirectories,
216with the same name as the current architecture,
217in every directory which it searches.
218Machine-specific areas are checked before general areas.
219The current machine type may be overridden by setting the environment
220variable
221.Ev MACHINE
222to the name of a specific architecture.
223Machine-specific man pages may also be requested by
224prepending the relevant subdirectory name to the page name,
225separated by
226.Ql Pa \&/ .
227(See also the
228.Dq _ Ns Aq machine
229line in the
230.Xr man.conf 5
231configuration file, which defines additional supplemental paths related to a
232specific machine type.)
233.It Ev MANPATH
234The standard search path used by
235.Nm
236may be overridden by specifying a path in the
237.Ev MANPATH
238environment variable.
239The format of the path is a colon
240.Pq Dq \&:
241separated list of directories.
242The subdirectories to be searched as well as their search order
243is specified by the
244.Dq _subdir
245line in the
246.Xr man.conf 5
247configuration file.
248.It Ev PAGER
249The pagination command used for writing the output.
250If the
251.Ev PAGER
252environment variable is null or not set, the standard pagination program
253.Xr more 1
254will be used.
255.El
256.Sh FILES
257.Bl -hang -width /etc/man.conf -compact
258.It Pa /etc/man.conf
259default man configuration file.
260.El
261.Sh SEE ALSO
262.Xr apropos 1 ,
263.Xr whatis 1 ,
264.Xr whereis 1 ,
265.Xr man.conf 5 ,
266.Xr mdoc 7 ,
267.Xr mdoc.samples 7
268.Sh STANDARDS
269.Nm
270conforms to
271.St -xcu5 .
272.\"and is expected to conform to
273.\".St -p1003.2-?? .
274.Sh BUGS
275The on-line man pages are, by necessity, forgiving toward stupid
276display devices, causing a few man pages to be not as nicely formatted
277as their typeset counterparts.
278