如何在 Linux 上搜索整个手册页?

Hel*_*ano 25 linux man documentation search

有时我需要在所有手册页中查找某些单词。我知道apropos,但如果我理解它的手册正确,它会将搜索限制为仅描述。

每个手册页中都有一个简短的说明。apropos 搜索关键字实例的描述。

例如,如果我查找诸如“viminfo”之类的词,则根本找不到任何结果...

$ apropos viminfo
viminfo: nothing appropriate.
Run Code Online (Sandbox Code Playgroud)

...虽然这个词存在于 Vim 手册的后面部分(安装在我的系统上)。

   -i {viminfo}
               When  using  the  viminfo file is enabled, this option sets the filename to use, instead of the default "~/.vim?
               info".  This can also be used to skip the use of the .viminfo file, by giving the name "NONE".
Run Code Online (Sandbox Code Playgroud)

那么我怎样才能在每本手册的每个部分中查找一个词呢?

mur*_*uru 40

来自man man

-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.
Run Code Online (Sandbox Code Playgroud)

这会直接为我打开联机帮助页(vim, then ex, then gview, ...),因此您可以添加另一个选项,例如-w了解将显示哪个联机帮助页。

$ man -wK viminfo
/usr/share/man/man1/vim.1.gz
/usr/share/man/man1/vim.1.gz
/usr/share/man/man1/gvim.1.gz
/usr/share/man/man1/gvim.1.gz
/usr/share/man/man1/run-one.1.gz
/usr/share/man/man1/gvim.1.gz
/usr/share/man/man1/gvim.1.gz
/usr/share/man/man1/run-one.1.gz
/usr/share/man/man1/run-one.1.gz
...
Run Code Online (Sandbox Code Playgroud)

  • -wK 组合特别有趣 (7认同)

cre*_*che 8

man.

 -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.
Run Code Online (Sandbox Code Playgroud)

所以,man -K viminfo会给你你需要的页面。