OpenBSD Journal
Home : : Add Story : : Archives : : About : : Create Account : : Login :
Faster and more capable whatis(1)/apropos(1)
Contributed by tbert on Tue Apr 22 15:02:20 2014 (GMT)
from the search me, man! dept.

Not one to get lost in the OpenSSL/m2k14 shuffle, Ingo Schwarze (schwarze@) has, after much work and improvement, updated the man page search functionality:

Date: Fri, 18 Apr 2014 04:00:48 -0600 (MDT)
From: Ingo Schwarze 
Subject: CVS: src

CVSROOT:        /cvs
Module name:    src
Changes by:        2014/04/18 04:00:48

Modified files:
        etc            : weekly
        libexec        : Makefile
        usr.bin        : Makefile
        usr.bin/mandoc : Makefile
        share/man      : Makefile
        share/man/man8 : daily.8

Log message:
Switch to the new makewhatis(8)/apropos(1)/whatis(1) combo.
"commit the switch now" espie@  "go for it" deraadt@

See the apropos(1) manual for a description of what's new.
On machines where you want the full functionality,
run "sudo makewhatis" and put "MAKEWHATISARGS=' '" into weekly.local(8).
Otherwise, when upgrading via source, run "sudo makewhatis -Q".

Users now have a powerful tool with which to more easily find information in the already-superb documentation. To quote the apropos(1) man page:

The apropos utility queries manual page databases generated by makewhatis(8), evaluating [the search] expression for each file in each database...Queries evaluate over a subset of mdoc(7) macros indexed by makewhatis(8).

The EXAMPLES section displays some of the wealth of possibilities:

     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$

For those of you attending BSDCan, Ingo will be presenting a talk that goes into much more depth about the improvements he's been making.


<< Call for Testing: vlan(4) improvements (Update updated) | Reply | Flattened | Expanded | It's Official: The OpenSSL Overhaul Is A Fork: Welcome LibreSSL in OpenBSD 5.6 >>

Threshold: Help

Related Links
more by tbert

  Re: Faster and more capable whatis(1)/apropos(1) (mod 3/29)
by sneaker ( on Wed Apr 23 20:29:36 2014 (GMT)
  [ Show thread ] [ Reply to this comment ] [ Mod Up ] [ Mod Down ]

  Re: Faster and more capable whatis(1)/apropos(1) (mod 1/27)
by thomasw_ ( ( on Fri Apr 25 00:31:05 2014 (GMT)
  this sounds useful, effective and eloquent to use. look forward to giving it a spin; thanks heaps, Ingo.
  [ Show thread ] [ Reply to this comment ] [ Mod Up ] [ Mod Down ]

  Re: Faster and more capable whatis(1)/apropos(1) (mod -2/28)
by jdv ( ( on Fri Apr 25 13:58:01 2014 (GMT)
  So, I can't quite tell from the documentation, but it looks like mandoc(1) is a replacement and improvement for man(1).

Or is mandoc(1) expected to be used to generate various document renditions from source (including legacy man)? I'm unclear on the relationship between classic man and mandoc, and the roadmap ahead.

Except running the actual mandoc command seems to imply that you need to know the section you are interested in. e.g., to get traditional:

$ mandoc mandoc.1

So, you can "format and display" documents, but I gather mandoc is more about the former than the latter.

Furthermore, if I want these benefits, I should retrain my muscle memory to use "apropos ..." instead of "man -k ..." Is that right?

Hopefully the slides from the BSDCan presentation will be published next month, as I could probably use the homework.
  [ Show thread ] [ Reply to this comment ] [ Mod Up ] [ Mod Down ]

[ Home | Add Story | Archives | Polls | About ]

Copyright © 2004-2008 Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to April 2nd 2004 as well as images and HTML templates were copied from the fabulous original with Jose's and Jim's kind permission. Some icons from used with permission from Kathleen. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. Search engine is ht://Dig. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]