1.\" $Id: apropos.1,v 1.17 2012/01/14 23:31:33 schwarze Exp $ 2.\" 3.\" Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: January 14 2012 $ 18.Dt APROPOS 1 19.Os 20.Sh NAME 21.Nm apropos 22.Nd search manual page databases 23.Sh SYNOPSIS 24.Nm 25.Op Fl C Ar file 26.Op Fl M Ar path 27.Op Fl m Ar path 28.Op Fl S Ar arch 29.Op Fl s Ar section 30.Ar expression ... 31.Sh DESCRIPTION 32The 33.Nm 34utility queries manual page databases generated by 35.Xr makewhatis 8 , 36evaluating on 37.Ar expression 38for each file in each database. 39.Pp 40By default, 41.Nm 42searches for 43.Xr makewhatis 8 44databases in the default paths stipulated by 45.Xr man 1 , 46parses terms as case-sensitive regular expressions 47.Pq the Li \&~ operator 48over manual names and descriptions 49.Pq the Li \&Nm No and Li \&Nd No macro keys . 50Multiple terms imply pairwise 51.Fl o . 52.Pp 53Its arguments are as follows: 54.Bl -tag -width Ds 55.It Fl C Ar file 56Specify an alternative configuration 57.Ar file 58in 59.Xr man.conf 5 60format. 61.It Fl M Ar path 62Use the colon-separated path instead of the default list of paths 63searched for 64.Xr makewhatis 8 65databases. 66Invalid paths, or paths without manual databases, are ignored. 67.It Fl m Ar path 68Prepend the colon-separated paths to the list of paths searched 69for 70.Xr makewhatis 8 71databases. 72Invalid paths, or paths without manual databases, are ignored. 73.It Fl S Ar arch 74Restrict the search to pages for the specified 75.Xr machine 1 76architecture. 77.Ar arch 78is case insensitive. 79By default, pages for all architectures are shown. 80.It Fl s Ar section 81Restrict the search to the specified section of the manual. 82By default, pages from all sections are shown. 83See 84.Xr man 1 85for a listing of sections. 86.El 87.Pp 88An 89.Ar expression 90consists of search terms joined by logical operators 91.Fl a 92.Pq and 93and 94.Fl o 95.Pq or . 96The 97.Fl a 98operator has precedence over 99.Fl o 100and both are evaluated left-to-right. 101.Bl -tag -width Ds 102.It \&( Ar expr No \&) 103True if the subexpression 104.Ar expr 105is true. 106.It Ar expr1 Fl a Ar expr2 107True if both 108.Ar expr1 109and 110.Ar expr2 111are true (logical 112.Qq and ) . 113.It Ar expr1 Oo Fl o Oc Ar expr2 114True if 115.Ar expr1 116and/or 117.Ar expr2 118evaluate to true (logical 119.Qq or ) . 120.It Ar term 121True if 122.Ar term 123is satisfied. 124This has syntax 125.Li [key[,key]*(=~)]?val , 126where operand 127.Cm key 128is an 129.Xr mdoc 7 130macro to query and 131.Cm val 132is its value. 133See 134.Sx Macro Keys 135for a list of available keys. 136Operator 137.Li \&= 138evaluates a substring, while 139.Li \&~ 140evaluates a regular expression. 141.It Fl i Ar term 142If 143.Ar term 144is a regular expression, it 145is evaluated case-insensitively. 146Has no effect on substring terms. 147.El 148.Pp 149Results are sorted by manual title, with output formatted as 150.Pp 151.D1 title(sec) \- description 152.Pp 153Where 154.Qq title 155is the manual's title (note multiple manual names may exist for one 156title), 157.Qq sec 158is the manual section, and 159.Qq description 160is the manual's short description. 161If an architecture is specified for the manual, it is displayed as 162.Pp 163.D1 title(cat/arch) \- description 164.Pp 165Resulting manuals may be accessed as 166.Pp 167.Dl $ man \-s sec title 168.Pp 169If an architecture is specified in the output, use 170.Pp 171.Dl $ man \-s sec \-S arch title 172.Ss Macro Keys 173Queries evaluate over a subset of 174.Xr mdoc 7 175macros indexed by 176.Xr makewhatis 8 . 177In addition to the macro keys listed below, the special key 178.Cm any 179may be used to match any available macro key. 180.Pp 181Names and description: 182.Bl -column "xLix" description -offset indent -compact 183.It Li \&Nm Ta manual name 184.It Li \&Nd Ta one-line manual description 185.El 186.Pp 187Sections and cross references: 188.Bl -column "xLix" description -offset indent -compact 189.It Li \&Sh Ta section header (excluding standard sections) 190.It Li \&Ss Ta subsection header 191.It Li \&Xr Ta cross reference to another manual page 192.It Li \&Rs Ta bibliographic reference 193.El 194.Pp 195Semantic markup for command line utilities: 196.Bl -column "xLix" description -offset indent -compact 197.It Li \&Fl Ta command line options (flags) 198.It Li \&Cm Ta command modifier 199.It Li \&Ar Ta command argument 200.It Li \&Ic Ta internal or interactive command 201.It Li \&Ev Ta environmental variable 202.It Li \&Pa Ta file system path 203.El 204.Pp 205Semantic markup for function libraries: 206.Bl -column "xLix" description -offset indent -compact 207.It Li \&Lb Ta function library name 208.It Li \&In Ta include file 209.It Li \&Ft Ta function return type 210.It Li \&Fn Ta function name 211.It Li \&Fa Ta function argument type and name 212.It Li \&Vt Ta variable type 213.It Li \&Va Ta variable name 214.It Li \&Dv Ta defined variable or preprocessor constant 215.It Li \&Er Ta error constant 216.It Li \&Ev Ta environmental variable 217.El 218.Pp 219Various semantic markup: 220.Bl -column "xLix" description -offset indent -compact 221.It Li \&An Ta author name 222.It Li \&Lk Ta hyperlink 223.It Li \&Mt Ta Do mailto Dc hyperlink 224.It Li \&Cd Ta kernel configuration declaration 225.It Li \&Ms Ta mathematical symbol 226.It Li \&Tn Ta tradename 227.El 228.Pp 229Physical markup: 230.Bl -column "xLix" description -offset indent -compact 231.It Li \&Em Ta italic font or underline 232.It Li \&Sy Ta boldface font 233.It Li \&Li Ta typewriter font 234.El 235.Pp 236Text production: 237.Bl -column "xLix" description -offset indent -compact 238.It Li \&St Ta reference to a standards document 239.It Li \&At Ta At No version reference 240.It Li \&Bx Ta Bx No version reference 241.It Li \&Bsx Ta Bsx No version reference 242.It Li \&Nx Ta Nx No version reference 243.It Li \&Fx Ta Fx No version reference 244.It Li \&Ox Ta Ox No version reference 245.It Li \&Dx Ta Dx No version reference 246.El 247.Sh ENVIRONMENT 248.Bl -tag -width MANPATH 249.It Ev MANPATH 250The standard search path used by 251.Xr man 1 252may be changed by specifying a path in the 253.Ev MANPATH 254environment variable. 255Invalid paths, or paths without manual databases, are ignored. 256Overridden by 257.Fl M . 258If 259.Ev MANPATH 260begins with a colon, it is appended to the default list; 261if it ends with a colon, it is prepended to the default list; 262or if it contains two adjacent colons, 263the standard search path is inserted between the colons. 264If none of these conditions are met, it overrides the 265standard search path. 266.El 267.Sh FILES 268.Bl -tag -width "/etc/man.conf" -compact 269.It Pa mandoc.db 270name of the 271.Xr makewhatis 8 272keyword database 273.It Pa mandoc.index 274name of the 275.Xr makewhatis 8 276filename database 277.It Pa /etc/man.conf 278default 279.Xr man 1 280configuration file 281.El 282.Sh EXIT STATUS 283.Ex -std 284.Sh EXAMPLES 285Search for 286.Qq .cf 287as a substring of manual names and descriptions: 288.Pp 289.Dl $ apropos .cf 290.Pp 291Include matches for 292.Qq .cnf 293and 294.Qq .conf 295as well: 296.Pp 297.Dl $ apropos .cf .cnf .conf 298.Pp 299Search in names and descriptions using a regular expression: 300.Pp 301.Dl $ apropos '~set.?[ug]id' 302.Pp 303Search for manuals in the library category mentioning both the 304.Qq optind 305and the 306.Qq optarg 307variables: 308.Pp 309.Dl $ apropos \-s 3 Va=optind \-a Va=optarg 310.Pp 311Do exactly the same as calling 312.Xr whatis 1 313with the argument 314.Qq ssh : 315.Pp 316.Dl $ apropos \-\- \-i 'Nm~[[:<:]]ssh[[:>:]]' 317.Sh SEE ALSO 318.Xr man 1 , 319.Xr re_format 7 , 320.Xr makewhatis 8 321.Sh HISTORY 322An 323.Nm 324utility first appeared in 325.Bx 2 . 326It was rewritten from scratch for 327.Ox 5.1 . 328.Pp 329The 330.Fl M 331option and the 332.Ev MANPATH 333variable first appeared in 334.Bx 4.3 ; 335.Fl m 336in 337.Bx 4.3 Reno ; 338.Fl C 339in 340.Bx 4.4 Lite1 ; 341and 342.Fl S 343and 344.Fl s 345in 346.Ox 4.5 . 347.Sh AUTHORS 348.An -nosplit 349.An Bill Joy 350wrote the original 351.Bx 352.Nm 353in February 1979. 354The current version was written by 355.An Kristaps Dzonsons , 356.Mt kristaps@bsd.lv . 357