8

This question already has an answer here:

Recently I wanted to get info of struct timespec a field of lstat structure, but I couldn't get any. I tried

$ man timespec
$ man -k timespec
 timespec: nothing appropriate.

After some time I went through man page of clock_gettime for unrelated query and there I got to know the structure of timespec. But this was accidentally. So timespec word was present in man page of clock_gettime but I was not able to search it.

So, I would like to know, how to search for a word in all manpages? or do a grep kind of search? Any hints?

marked as duplicate by don_crissti, G-Man, Anthon, cuonglm, taliezin Sep 1 '15 at 5:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Tangential to your actual question, but in case it's helpful: /usr/include has system header files that you can easily grep. – Jeff Schaller Aug 31 '15 at 22:36
7

I normally fall back to google in such circumstances but try using man -K.

From the man man page:

-k, --apropos

    Equivalent to apropos. Search the short manual page descriptions for keywords and display any matches. See apropos(1) for details.

-K, --global-apropos

    Search for text in all manual pages. This is a brute-force search, and is likely to take some time; if you can, you should specify a section to reduce the number of pages that need to be searched. Search terms may be simple strings (the default), or regular expressions if the --regex option is used.

  • Thanks for the edit @Peter.O, I'll try to wean my addiction to code tags! – Michael Shaw Sep 1 '15 at 14:26
0

apropos timespec.

That will search through all the man pages for "timespec".

  • apropos is just an alias for man -k – schily Aug 31 '15 at 22:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.