.\" $NetBSD: apropos.1,v 1.23 2022/05/17 11:37:54 uwe Exp $
.\"
.\" Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
.\" All rights reserved.
.\"
.\" This code was developed as part of Google's Summer of Code 2011 program.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd May 17, 2022
.Dt APROPOS 1
.Os
.Sh NAME
.Nm apropos
.Nd search the complete content of all man pages
.Sh SYNOPSIS
.Nm
.Op Fl 123456789hilMmPpr
.Op Fl C Ar path
.Op Fl n Ar results
.Op Fl S Ar machine
.Op Fl s Ar section
.Ar query
.Sh DESCRIPTION
The
.Nm
utility performs a full text search over the complete content of all man pages.
It uses the FTS engine of SQLite to perform the search.
The database is created with the help of the
.Xr makemandb 8
utility.
.Pp
This implementation of the
.Nm
utility is more sophisticated than the classical version.
Like modern search applications, it uses advanced techniques like stemming
and term weighting to rank the matching results in decreasing order of
relevance.
.Pp
Quotes are optional for specifying multiword queries.
.Pp
It supports the following options:
.Bl -tag -width Fl
.It Fl 1 , No \&... , Fl 9
Limit the search to the specified section of the manual.
By default, pages from all sections are shown.
These options are abbreviations for the
.Fl s
option for single digit sections.
.It Fl C Ar path
Use different
.Xr man 1
configuration file than the default,
.Pa /etc/man.conf .
.It Fl h
Turn on html formatting.
.It Fl i
Turn on terminal escape code formatting.
.It Fl l
Legacy mode: Only searches name and name description.
Does not print context and turns off formatting.
.It Fl M
Do not show the context of the match.
.It Fl m
Show the context of the match (default).
.It Fl n Ar results
Output up to the specified number of search results.
The default limit is infinity.
.It Fl P
Turn on pager formatting.
.It Fl p
Turn on pager formatting, and pipe the results through a pager (defaulting to
.Xr more 1 ) .
.It Fl r
Turn off formatting.
.It Fl S Ar machine
Limit the search to the pages for the specified machine architecture.
By default pages for all architectures are shown in the search results.
.It Fl s Ar section
Limit the search to the specified section of the manual.
By default, pages from all sections are shown.
For single digit sections you can use abbreviations:
.Fl 1 , No \&... , Fl 9 .
.El
.Sh FILES
.Bl -hang -width /etc/man.conf -compact
.It Pa /etc/man.conf
The location of the SQLite FTS database can be configured using the
.Cd _mandb
tag.
.El
.Sh ENVIRONMENT VARIABLES
.Bl -tag -width Ev
.It Ev APROPOS
This environment variable is white-space tokenized as an argument vector
and the options in it are parsed and set.
Command line options override the environment options.
.It Ev PAGER
The pagination command used for writing the output, should this be requested.
If the
.Ev PAGER
environment variable is null or not set, the standard pagination program
.Xr more 1
will be used.
.El
.Sh SEE ALSO
.Xr man 1 ,
.Xr whatis 1 ,
.Xr man.conf 5 ,
.Xr makemandb 8
.Sh HISTORY
The
.Nm
command appeared in
.Bx 3 .
It was rewritten in
.Nx 6.0
to support full text search using SQLite.
.Sh AUTHORS
.An Abhinav Upadhyay