Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
man uses a sophisticated method of finding manual page files, based on the invocation options and environment variables, the /etc/man.config configuration file, and some built in conventions and heuristics.
So obviously, the manfiles aren't all in a single directory tree. So is there a nice terse command I can use to be able to grep through all manual page files as defined by these settings?
I'll write a script if I have to, but I'd like to avoid it so I can do it on whatever box I'm faced with. My linux/bash skillz are getting better all the time, but they aren't yet good enough to figure this one out.
it's popping up some error messages about not being able to find the occasional path/name.n.gz which is vexing as in those cases path/name.n already exists. Anyway, can anyone beat that command?
No, I know about apropos, but far too often it returns "nothing appropriate". I like my regular expressions.
apropos will allow you to search for regular expressions:
Code:
apropos -r some_re
Or you can search for shell-style glob wildcards:
Code:
apropos -w 'some_wilcard*'
If you still want to do it yourself for fun, here's how I would approach it.
All the following in a Perl script
Parse /etc/manpath.sections - extract SECTIONS and base PATH
Make a list of MANDATORY_PATHs
Add the list from the MANPATH environment variable if defined
Iterate over the list of paths adding sections. This'll give you the list of directories to search
Iterate over the list of directories opening files with gunzip if necessary, and extracting the info you want. Be aware the manpage markup is a little weird.
You could use nroff -man to process them too. Thing is, parsing thousands of man pages will take quite some time. You'll probably want to build an index and search that with your tool. If you do that, you'll need some sort of index update job. This is a similar approach to updatedb/locate.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.