NAME
apropos
—
search manual page databases
SYNOPSIS
apropos |
[-C file]
[-M path]
[-m path]
[-O outkey]
[-S arch]
[-s section]
expression ... |
DESCRIPTION
The apropos
utility queries manual page
databases generated by
makewhatis(8), evaluating expression
for each file in each database. By default, it displays the names, section
numbers, and description lines of all matching manuals.
By default, apropos
searches for
makewhatis(8) databases in the default paths stipulated by
man(1) and uses case-insensitive substring matching (the
=
operator) over manual
names and descriptions (the Nm
and Nd
macro keys). Multiple terms imply pairwise
-o
.
Its arguments are as follows:
-C
file- Specify an alternative configuration file in man.conf(5) format.
-M
path- Use the colon-separated path instead of the default list of paths searched for makewhatis(8) databases. Invalid paths, or paths without manual databases, are ignored.
-m
path- Prepend the colon-separated paths to the list of paths searched for makewhatis(8) databases. Invalid paths, or paths without manual databases, are ignored.
-O
outkey- Show the values associated with the key outkey instead of the manual descriptions.
-S
arch- Restrict the search to pages for the specified machine(1) architecture. arch is case insensitive. By default, pages for all architectures are shown.
-s
section- Restrict the search to the specified section of the manual. By default, pages from all sections are shown. See man(1) for a listing of sections.
An expression consists of search terms
joined by logical operators -a
(and) and
-o
(or). The -a
operator has
precedence over -o
and both are evaluated
left-to-right.
- ( expr )
- True if the subexpression expr is true.
- expr1
-a
expr2 - True if both expr1 and expr2 are true (logical ‘and’).
- expr1 [
-o
] expr2 - True if expr1 and/or expr2 evaluate to true (logical ‘or’).
- term
- True if term is satisfied. This has syntax
[[key[,key...]](
=
|~
)]val, where key is an mdoc(7) macro to query and val is its value. See Macro Keys for a list of available keys. Operator=
evaluates a substring, while~
evaluates a regular expression. -i
term- If term is a regular expression, it is evaluated case-insensitively. Has no effect on substring terms.
Results are sorted by manual sections and names, with output formatted as
Where “name” is the manual's name, “sec” is the manual section, and “description” is the manual's short description. If an architecture is specified for the manual, it is displayed as
Resulting manuals may be accessed as
$ man -s sec name
If an architecture is specified in the output, use
$ man -s sec -S arch
name
Macro Keys
Queries evaluate over a subset of
mdoc(7) macros indexed by
makewhatis(8). In addition to the macro keys listed below,
the special key any
may be used to match any
available macro key.
Names and description:
Nm |
manual name |
Nd |
one-line manual description |
arch |
machine architecture (case-insensitive) |
sec |
manual section number |
Sections and cross references:
Sh |
section header (excluding standard sections) |
Ss |
subsection header |
Xr |
cross reference to another manual page |
Rs |
bibliographic reference |
Semantic markup for command line utilities:
Fl |
command line options (flags) |
Cm |
command modifier |
Ar |
command argument |
Ic |
internal or interactive command |
Ev |
environmental variable |
Pa |
file system path |
Semantic markup for function libraries:
Lb |
function library name |
In |
include file |
Ft |
function return type |
Fn |
function name |
Fa |
function argument type and name |
Vt |
variable type |
Va |
variable name |
Dv |
defined variable or preprocessor constant |
Er |
error constant |
Ev |
environmental variable |
Various semantic markup:
An |
author name |
Lk |
hyperlink |
Mt |
“mailto” hyperlink |
Cd |
kernel configuration declaration |
Ms |
mathematical symbol |
Tn |
tradename |
Physical markup:
Em |
italic font or underline |
Sy |
boldface font |
Li |
typewriter font |
Text production:
St |
reference to a standards document |
At |
AT&T UNIX version reference |
Bx |
BSD version reference |
Bsx |
BSD/OS version reference |
Nx |
NetBSD version reference |
Fx |
FreeBSD version reference |
Ox |
OpenBSD version reference |
Dx |
DragonFly version reference |
ENVIRONMENT
MANPATH
- The standard search path used by
man(1) may be changed by specifying a path in the
MANPATH
environment variable. Invalid paths, or paths without manual databases, are ignored. Overridden by-M
. IfMANPATH
begins with a colon, it is appended to the default list; if it ends with a colon, it is prepended to the default list; or if it contains two adjacent colons, the standard search path is inserted between the colons. If none of these conditions are met, it overrides the standard search path.
FILES
- mandoc.db
- name of the makewhatis(8) keyword database
- /etc/man.conf
- default man(1) configuration file
EXIT STATUS
The apropos
utility exits 0 on
success, and >0 if an error occurs.
EXAMPLES
Search for ".cf" as a substring of manual names and descriptions:
$ apropos .cf
Include matches for ".cnf" and ".conf" as well:
$ apropos .cf .cnf .conf
Search in names and descriptions using a regular expression:
$ apropos '~set.?[ug]id'
Search for manuals in the library section mentioning both the "optind" and the "optarg" variables:
$ apropos -s 3 Va=optind -a
Va=optarg
Do exactly the same as calling whatis(1) with the argument "ssh":
$ apropos -- -i
'Nm~[[:<:]]ssh[[:>:]]'
The following two invocations are equivalent:
$ apropos -S
arch -s
section
expression$ apropos \(
expression \)
-a
arch~^(
arch|any)$
-a
sec~^
section$
SEE ALSO
HISTORY
An apropos
utility first appeared in
2BSD. It was rewritten from scratch for
OpenBSD 5.6.
The -M
option and the
MANPATH
variable first appeared in
4.3BSD; -m
in
4.3BSD-Reno; -C
in
4.4BSD-Lite1; and -S
and
-s
in OpenBSD 4.5.
AUTHORS
Bill Joy wrote the original
BSD apropos
in February
1979. The current version was written by Kristaps
Dzonsons
<kristaps@bsd.lv> and
Ingo Schwarze
<schwarze@openbsd.org>.