6 ms·
Which is why the parent advised to treat the man page like a reference document, by searching in it. Some man pages are just badly written and are indigestible
by tomsmeding 9y ago
Which is why the parent advised to treat the man page like a reference document, by searching in it. Some man pages are just badly written and are indigestible even when searching for a specific thing, but in general, that approach works quite often.
- falcolas 9y agoAnd even in the worst case, the man pages give you more context to use in your subsequent web search. To use the original example, once you've identified that $(...) is Command Substitution, you have something that pulls up meaningful results in every search engine.
- hyperpape 9y agoIs there some trick to searching man pages that I don’t know? Because my usual experience is: type man foo type /-p type n n n n n n n n n as there are a bunch of matches like “...does bar when combined with -p...” A presentation of man pages that used hypertext would make me a lot happier.
- anjbe 9y agoBSD man pages (and many Linux man pages, though a minority) are written in semantic “mdoc” macros, rather than the classic “man” macros that are strictly presentational. If you’re using mandoc (http://mandoc.bsd.lv/ http://mandoc.bsd.lv/) as your man(1) program—the default on OpenBSD and a couple of Linuxes like Void and Alpine—it will use these semantics to generate hyperlinks in the terminal using more(1) and less(1)’s ctags support. So on my machine, your example becomes: type man foo type :t type p This brings me to the first instance of a command‐line flag named “-p” or environment variable named “p” in an itemized list. It translates to HTML too—check out the links generated by the web viewer, which uses the same backend. https://man.openbsd.org/ls.1 https://man.openbsd.org/ls.1
- hyperpape 9y agoThat’s awesome! I think a table of contents could be nice addition for the HTML version (at least for pages that are longer than less).
- imurray 9y agoYou might want to search with / -p
- hyperpape 9y agoThanks, but I think this validates a demand for real hypertext.
- gbacon 9y agoWhile you’re waiting for the rest of the world to agree with you and then implement the true hypertext manuals, consider sharpening your regex saw.
- anjbe 9y agoIn OpenBSD, we have true hypertext manuals today: https://news.ycombinator.com/item?id=16089300 https://news.ycombinator.com/item?id=16089300
- nine_k 9y agoman man man less Not a joke. Learn the simple tools that help you daily.
- hyperpape 9y agoDid you have something in mind? I’ve read those man pages before, and I read them again today, and with the possible exception of tags in less (but I’m not sure about that), nothing seems relevant.
- nine_k 9y agoI'm sorry for sounding condescending! I did not understand your problem initially. What helps me somehow is the fact that definitions in man pages are usually start on a new line and are indented by several spaces. man bash / -o This finds an inline mention, not very useful. man bash /^ +-o This finds the definition: start of line, then some space, then the -o.
- Pete_D 9y agoIf foo has a Texinfo manual (GNU tools like bash usually do) then you can try `info foo` and search the index with i or I for -p. Texinfo manuals also have hyperlinks you can press enter on. info is a greatly underused system and I'd recommend any *nix users to spend some time learning how to navigate it.
- hyperpape 9y agoThanks. Is there a good way to open that in a browser, rather than a console?
- teddyh 9y agoIn general, the best way to read Info documentation is inside Emacs.
- oblio 9y ago"If you are a bash newbie, you should read the bash manual. If you want proper search for the manual, you should use info. If you want proper use of info, you should use Emacs." Kind of a deep rabbit hole, isn't it?
- Pete_D 9y agoI don't know if you can locally, but they're often published online in HTML format, like at https://www.gnu.org/software/bash/manual/html_node/index.html https://www.gnu.org/software/bash/manual/html_node/index.htm....
- metaobject 9y agoYou can also do keyword searches across all man pages like: man -k <keyword>
- mdaniel 9y agoas there are a bunch of matches like "...does bar when combined with -p..." It has been my experience that the definition of switches, unlike their use in examples or other text, occurs as the first thing on the line, so my search expression would be: /^ *-p (you likely can't see it, but there is a trailing space, too, to ensure it's just that flag, and not "-parallel" or whatever) It's possible the text will be tab-indented, in which case: /^[ ^I]*-p[ ^I] (most pagers will accept just pressing the tab key in the search string, and it may show up as ^I or the literal tab character)
- npongratz 9y agoYou can use apropos to search names and descriptions inside man pages. For example: $ apropos timezone Date::Manip::DM5abbrevs (3pm) - A list of all timezone abbreviations dm_zdump (1p) - timezone dumper Time::Zone (3pm) - - miscellaneous timezone manipulations routines timezone (3) - initialize time conversion information tzfile (5) - timezone information tzselect (1) - view timezones tzselect (8) - select a timezone zdump (8) - timezone dumper zic (8) - timezone compiler Can even search using regular expressions.
- gbacon 9y agoUsually options are typeset similar to -p Potrzebie mode ... So search for it, e.g., /^ *-p The caret regex anchor matches at the beginning of line, and the Kleene star matches zero or more of the previous pattern. In English, the above pattern reads “match -p only when it occurs as the first nonblank characters on the line.” The surrounding context may be different, so adapt your search pattern accordingly.