I finally got fed up when wanting to read about bash's read
and it's -s
option with man bash
. I found the right spot eventually (around line 4500), but it was a frustrating as usual, since both /read
and even /\s-s\s
searches have way too many matches.
So, the question is: How can I read long man pages efficiently, or get same information in other ways, locally? As a specific example, how to reach the relevant documentation after seeing read -s pwd
in a shell script? A good answer could be a shell script snippet, or hint about some tool and how it is used, or something else entirely, as long as it helps in finding the right spot to read.
Note: I'm not tagging with bash because I want the question to be about man page reading in general, even though that quite possibly is the most commonly encountered humongous man page.
Best Answer
For quickly getting help on a Bash builtin, use
help
:is what you want.
For man-page-like formatting, use
or, even better,
If you still insist on looking for it in the man page, I find what quickly gets me to a command's explanation is
This works because when a command is first explained, its name is indented slightly from the start of the line. In the particular case of
read
, this takes a little browsing before you get to the actualread
documentation because (for obvious reasons) the word "read" is repeated a lot throughout the man page. The [[] means to match a [ which usually precedes optional parameters. (I usually leave out /^\s* and simply do /<built-in command> [[])Another alternative
If you don't mind the format change, you can convert your man page to a DVI or PDF file:
or
Of course, given a DVI or PDF document, you can then do a text search easily.