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 adho 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 m Ar arch Ns Op : Ns Ar machine 148Override the default architecture and machine settings allowing lookup of 149other platform specific manual pages. 150See 151.Sx IMPLEMENTATION NOTES 152for how this option changes the default behavior. 153Overrides the 154.Ev MACHINE_ARCH 155and 156.Ev MACHINE 157environment variables. 158.It Fl o 159Force use of non-localized manual pages. 160See 161.Sx IMPLEMENTATION NOTES 162for how locale specific searches work. 163Overrides the 164.Ev LC_ALL , LC_CTYPE , 165and 166.Ev LANG 167environment variables. 168.It Fl p Op Cm eprtv 169Use the list of given preprocessors before running 170.Xr nroff 1 Pq Pa ports/textproc/groff 171or 172.Xr troff 1 Pq Pa ports/textproc/groff . 173Valid preprocessors arguments: 174.Pp 175.Bl -tag -width indent -compact 176.It Cm e 177.Xr eqn 1 Pq Pa ports/textproc/groff 178.It Cm p 179.Xr pic 1 Pq Pa ports/textproc/groff 180.It Cm r 181.Xr refer 1 Pq Pa ports/textproc/groff 182.It Cm t 183.Xr tbl 1 Pq Pa ports/textproc/groff 184.It Cm v 185.Xr vgrind 1 186.El 187.Pp 188Overrides the 189.Ev MANROFFSEQ 190environment variable. 191.It Fl t 192Send manual page source through 193.Xr troff 1 Pq Pa ports/textproc/groff 194allowing transformation of the manual pages to other formats. 195.It Fl w 196Display the location of the manual page instead of the contents of 197the manual page. 198.El 199.Sh IMPLEMENTATION NOTES 200.Ss Locale Specific Searches 201The 202.Nm 203utility supports manual pages in different locales. 204The search behavior is dictated by the first of three 205environment variables with a nonempty string: 206.Ev LC_ALL , LC_CTYPE , 207or 208.Ev LANG . 209If set, 210.Nm 211will search for locale specific manual pages using the following logic: 212.Pp 213.Bl -item -offset indent -compact 214.It 215.Va lang Ns _ Ns Va country . Ns Va charset 216.It 217.Va lang . Ns Va charset 218.It 219.Li en . Ns Va charset 220.El 221.Pp 222For example, if 223.Ev LC_ALL 224is set to 225.Ql ja_JP.eucJP , 226.Nm 227will search the following paths when considering section 1 manual pages in 228.Pa /usr/share/man : 229.Pp 230.Bl -item -offset indent -compact 231.It 232.Pa /usr/share/man/ja_JP.eucJP/man1 233.It 234.Pa /usr/share/man/ja.eucJP/man1 235.It 236.Pa /usr/share/man/en.eucJP/man1 237.It 238.Pa /usr/share/man/man1 239.El 240.Ss Platform Specific Searches 241The 242.Nm 243utility supports platform specific manual pages. 244The search behavior is dictated by the 245.Fl m 246option or the 247.Ev MACHINE_ARCH 248and 249.Ev MACHINE 250environment variables. 251For example, if 252.Ev MACHINE_ARCH 253is set to 254.Ql aarch64 255and 256.Ev MACHINE 257is set to 258.Ql arm64 , 259.Nm 260will search the following paths when considering section 4 manual pages in 261.Pa /usr/share/man : 262.Pp 263.Bl -item -offset indent -compact 264.It 265.Pa /usr/share/man/man4/aarch64 266.It 267.Pa /usr/share/man/man4/arm64 268.It 269.Pa /usr/share/man/man4 270.El 271.Ss Displaying Specific Manual Files 272The 273.Nm 274utility also supports displaying a specific manual page if passed a path 275to the file as long as it contains a 276.Ql / 277character. 278.Sh ENVIRONMENT 279The following environment variables affect the execution of 280.Nm : 281.Bl -tag -width indent 282.It Ev LC_ALL , Ev LC_CTYPE , Ev LANG 283Used to find locale specific manual pages. 284Valid values can be found by running the 285.Xr locale 1 286command. 287See 288.Sx IMPLEMENTATION NOTES 289for details. 290Influenced by the 291.Fl o 292option. 293.It Ev MACHINE_ARCH , Ev MACHINE 294Used to find platform specific manual pages. 295If unset, the output of 296.Ql sysctl Va hw.machine_arch 297and 298.Ql sysctl Va hw.machine 299is used respectively. 300See 301.Sx IMPLEMENTATION NOTES 302for details. 303Corresponds to the 304.Fl m 305option. 306.It Ev MANPATH 307A colon 308.Pq Ql \&: 309separated list of directories to check for manual pages. 310Invalid paths, or paths without manual databases, are ignored. 311Overridden by 312.Fl M . 313If 314.Ev MANPATH 315begins with a colon, it is appended to the default list; 316if it ends with a colon, it is prepended to the default list; 317or if it contains two adjacent colons, 318the standard search path is inserted between the colons. 319If none of these conditions are met, it overrides the 320standard search path. 321See 322.Xr manpath 1 . 323.It Ev MANROFFSEQ 324Used to determine the preprocessors for the manual source before running 325.Xr nroff 1 Pq Pa ports/textproc/groff 326or 327.Xr troff 1 Pq Pa ports/textproc/groff . 328If unset, defaults to 329.Xr tbl 1 Pq Pa ports/textproc/groff . 330Corresponds to the 331.Fl p 332option. 333.It Ev MANSECT 334Restricts manual sections searched to the specified colon delimited list. 335Corresponds to the 336.Fl S 337option. 338.It Ev MANWIDTH 339If set to a numeric value, used as the width manpages should be displayed. 340Otherwise, if set to a special value 341.Ql tty , 342and output is to a terminal, 343the pages may be displayed over the whole width of the screen. 344.It Ev MANCOLOR 345If set, enables color support. 346.It Ev MANPAGER 347Program used to display files. 348.Pp 349If unset, and color support is enabled, 350.Ql less -sR 351is used. 352.Pp 353If unset, and color support is disabled, then 354.Ev PAGER 355is used. 356If that has no value either, 357.Ql less -s 358is used. 359.El 360.Sh FILES 361.Bl -tag -width "/usr/local/etc/man.d/*.conf" -compact 362.It Pa /etc/man.conf 363System configuration file 364.It Pa /usr/local/etc/man.d/*.conf 365Local configuration files 366.El 367.Sh EXIT STATUS 368.Ex -std 369.Sh EXAMPLES 370Show the manual page for 371.Xr stat 2 : 372.Pp 373.Dl $ man 2 stat 374.Pp 375Show all manual pages for 376.Ql stat : 377.Pp 378.Dl $ man -a stat 379.Pp 380List manual pages which match the regular expression either in the title or in 381the body: 382.Pp 383.Dl $ man -k '\e<copy\e>.*archive' 384.Pp 385Show the manual page for 386.Xr ls 1 387using 388.Xr cat 1 389as the pager: 390.Pp 391.Dl $ man -P cat ls 392.Pp 393Show the location of the 394.Xr ls 1 395manual page: 396.Pp 397.Dl $ man -w ls 398.Pp 399Show a manual page in the current working directory: 400.Pp 401.Dl $ man ./man.1 402.Pp 403Show the location of manual pages in sections 1 and 8 which contain the word 404.Ql arm : 405.Pp 406.Dl $ man -w -K '\e<arm\e>' -S 1:8 407.Sh SEE ALSO 408.Xr apropos 1 , 409.Xr intro 1 , 410.Xr mandoc 1 , 411.Xr manpath 1 , 412.Xr whatis 1 , 413.Xr intro 2 , 414.Xr intro 3 , 415.Xr intro 3lua , 416.Xr intro 4 , 417.Xr intro 5 , 418.Xr man.conf 5 , 419.Xr intro 6 , 420.Xr intro 7 , 421.Xr mdoc 7 , 422.Xr re_format 7 , 423.Xr intro 8 , 424.Xr intro 9 425