Not a direct answer to your question, but to more easily find documentation in a large manual like bash
's, you could try these alternatives:
Using a different format like info
The bash
manual like the manual of most GNU software is written in texinfo, from which several formats are derived (man, info, pdf, html...).
A man page is called a page for a reason. It's just one flat text file where the only structuring is done via font formatting (indentation, bold, underline, all-caps).
For a manual this size, you'd rather want a book than a page.
While man
implements the page paradigm, info implements the book paradigm. It has concepts of chapter/sections, table of content, references and index, all of which searchable with completion.
In a book about bash, to learn about the read
builtin, you'd look at the index. In info
, you type i
, and then enter read
(completion available) which will bring you directly to the documentation of the read
builtin (use ,
to jump to the next index entry that contains read
). You can also start info
as info bash read
.
In a book, if you wanted to see the section about builtins, you'd check the index again, or look at the table of contents. Same in info
with i
and g
.
Search the web
HTML is another hypertext format (note that info
predates the web and HTML) well fitted for larger manuals. Web browsers can usually only search in a single page at a time which makes it not as good as info
, but if you're online, you can make use of search engines like duckduckgo or google to search manuals.
bash read builtin site:gnu.org
would likely take you to the section that contains the documentation for read
. Or you can use the index: https://www.gnu.org/software/bash/manual/html_node/Builtin-Index.html#Builtin-Index
search man page based on other formatting
Instead of searching for bold/underline text which is not easy to do with current man pagers, you could also try:
- search for
read
at the beginning of the line: /^\s*read
- also as a whole word:
/^\s*read\>/
you can also use the fact that section headers are less indented, to get a form of table of contents.
In the most
pager, that can be done with 1:od
to hide text that is indented, 4:od
to hide text indented by at least 4 columns.
With less
, you can do the same with &^\S
and &^ {,3}\S
, which would show something like:
[...]
RESERVED WORDS
SHELL GRAMMAR
Simple Commands
Pipelines
Lists
Compound Commands
Coprocesses
Shell Function Definitions
COMMENTS
QUOTING
[...]
and let you navigate more easily to a section of interest (and then just enter an empty &
to see the full text again, or :od
in most
).
info
instead ofman
and use the index.i
– Stéphane Chazelas Mar 22 '16 at 21:30info
without getting seriously lost all over the place. e.g. typinginfo ls
and searching forhello
brings me to ... I have no idea where ... but it's not thels
documentation ... Pressing Pageup a few times brings me to ... somewhere else ... but also not thels
documentation ... I find it seriously confusing :-/ But perhaps I need to re-investigate (it's been years since I seriously looked atinfo
) – Martin Tournoij Mar 22 '16 at 21:41bash
's – Stéphane Chazelas Mar 22 '16 at 21:42