Reading and searching long man pages

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
28
down vote

favorite
12












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-ss 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.










share|improve this question























  • I'm not putting this as an answer because it may be outside your requirements but: when I need to read a long man page I use a little script i leave on my upper panel. yuugian.com/demo/gkman.txt Share and enjoy
    – Yuugian
    Oct 15 '13 at 13:01











  • I'm not putting this as an answer either ;) because it's indeed about bash itself: just like you, I too mostly need the SHELL BUILTINS part of the manual, which is at about line 3500. So knowing this, the next time I would just say man bash and then go down 66 percent, by typing 66%, then a few times PgDn and I'm there. Though I chose 66 because it can be memorized as "Route 66", it is actually a little more than that, albeit not so easy to memorize unless it is the beginning of your phone #, etc. :) At least the "Route 66" is universal and known worldwide.
    – syntaxerror
    Dec 14 '14 at 22:45















up vote
28
down vote

favorite
12












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-ss 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.










share|improve this question























  • I'm not putting this as an answer because it may be outside your requirements but: when I need to read a long man page I use a little script i leave on my upper panel. yuugian.com/demo/gkman.txt Share and enjoy
    – Yuugian
    Oct 15 '13 at 13:01











  • I'm not putting this as an answer either ;) because it's indeed about bash itself: just like you, I too mostly need the SHELL BUILTINS part of the manual, which is at about line 3500. So knowing this, the next time I would just say man bash and then go down 66 percent, by typing 66%, then a few times PgDn and I'm there. Though I chose 66 because it can be memorized as "Route 66", it is actually a little more than that, albeit not so easy to memorize unless it is the beginning of your phone #, etc. :) At least the "Route 66" is universal and known worldwide.
    – syntaxerror
    Dec 14 '14 at 22:45













up vote
28
down vote

favorite
12









up vote
28
down vote

favorite
12






12





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-ss 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.










share|improve this question















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-ss 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.







search man






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 15 '13 at 19:12









Gilles

517k12310311559




517k12310311559










asked Oct 15 '13 at 8:17









hyde

4961516




4961516











  • I'm not putting this as an answer because it may be outside your requirements but: when I need to read a long man page I use a little script i leave on my upper panel. yuugian.com/demo/gkman.txt Share and enjoy
    – Yuugian
    Oct 15 '13 at 13:01











  • I'm not putting this as an answer either ;) because it's indeed about bash itself: just like you, I too mostly need the SHELL BUILTINS part of the manual, which is at about line 3500. So knowing this, the next time I would just say man bash and then go down 66 percent, by typing 66%, then a few times PgDn and I'm there. Though I chose 66 because it can be memorized as "Route 66", it is actually a little more than that, albeit not so easy to memorize unless it is the beginning of your phone #, etc. :) At least the "Route 66" is universal and known worldwide.
    – syntaxerror
    Dec 14 '14 at 22:45

















  • I'm not putting this as an answer because it may be outside your requirements but: when I need to read a long man page I use a little script i leave on my upper panel. yuugian.com/demo/gkman.txt Share and enjoy
    – Yuugian
    Oct 15 '13 at 13:01











  • I'm not putting this as an answer either ;) because it's indeed about bash itself: just like you, I too mostly need the SHELL BUILTINS part of the manual, which is at about line 3500. So knowing this, the next time I would just say man bash and then go down 66 percent, by typing 66%, then a few times PgDn and I'm there. Though I chose 66 because it can be memorized as "Route 66", it is actually a little more than that, albeit not so easy to memorize unless it is the beginning of your phone #, etc. :) At least the "Route 66" is universal and known worldwide.
    – syntaxerror
    Dec 14 '14 at 22:45
















I'm not putting this as an answer because it may be outside your requirements but: when I need to read a long man page I use a little script i leave on my upper panel. yuugian.com/demo/gkman.txt Share and enjoy
– Yuugian
Oct 15 '13 at 13:01





I'm not putting this as an answer because it may be outside your requirements but: when I need to read a long man page I use a little script i leave on my upper panel. yuugian.com/demo/gkman.txt Share and enjoy
– Yuugian
Oct 15 '13 at 13:01













I'm not putting this as an answer either ;) because it's indeed about bash itself: just like you, I too mostly need the SHELL BUILTINS part of the manual, which is at about line 3500. So knowing this, the next time I would just say man bash and then go down 66 percent, by typing 66%, then a few times PgDn and I'm there. Though I chose 66 because it can be memorized as "Route 66", it is actually a little more than that, albeit not so easy to memorize unless it is the beginning of your phone #, etc. :) At least the "Route 66" is universal and known worldwide.
– syntaxerror
Dec 14 '14 at 22:45





I'm not putting this as an answer either ;) because it's indeed about bash itself: just like you, I too mostly need the SHELL BUILTINS part of the manual, which is at about line 3500. So knowing this, the next time I would just say man bash and then go down 66 percent, by typing 66%, then a few times PgDn and I'm there. Though I chose 66 because it can be memorized as "Route 66", it is actually a little more than that, albeit not so easy to memorize unless it is the beginning of your phone #, etc. :) At least the "Route 66" is universal and known worldwide.
– syntaxerror
Dec 14 '14 at 22:45











9 Answers
9






active

oldest

votes

















up vote
29
down vote



+50










For quickly getting help on a Bash builtin, use help:



help read


is what you want.



For man-page-like formatting, use



help -m read


or, even better,



help -m read | less


If you still insist on looking for it in the man page, I find what quickly gets me to a command's explanation is



/^s*read [


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 actual read 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:



man -T dvi bash >bash.dvi


or



man -T ps bash | ps2pdf - bash.pdf # Requires the Ghostscript suite for ps2pdf


Of course, given a DVI or PDF document, you can then do a text search easily.






share|improve this answer






















  • Hmm, that help is great, I wonder how I've never heard of it... ps2pdf is not that useful since it can't (apparently) create index of any kind.
    – hyde
    Oct 15 '13 at 12:04










  • @hyde Not sure what you mean by creating an index, but have you heard of ptx?
    – Joseph R.
    Oct 15 '13 at 12:12











  • Index or Table of Contents, that "ptx" sounds exactly like what I meant.
    – hyde
    Oct 16 '13 at 7:06






  • 1




    Another, even simpler alternative is to do 'man bash > bashman.txt'. Then you can just open bashman.txt in (another) window in your text editor and use all of it's commands for finding what you want. You can even edit the file to add tags for the sections you refer to most often. Making bashman.txt read-only helps so you don't modify it by accident in your editor.
    – Joe
    Oct 20 '13 at 3:58










  • You can also open man pages in the browser of your choice and use all of its tools. See askubuntu.com/questions/339255/…
    – Joe
    Oct 20 '13 at 4:00

















up vote
9
down vote













Approach 1



man bash then /read [ then /-s



Approach 2



You may try an open source tool for explaining command-line arguments called explainshell.



It can be used locally. Read documentation on https://github.com/idank/explainshell



Caveats: Usually works, but only with commands found in Ubuntu's manpage repository



In your case, it cannot recognize -s switch in read -s pwd.



Approach 3



I have found another tool that seems promising but it does not work on my system.



explain: Short Documentation for Unix Commands






share|improve this answer






















  • Interesting links, thanks!
    – hyde
    Oct 15 '13 at 10:40










  • With approach 1, you can do /-sb to avoid hits like --some-other-command (while still finding strings such as -s,, which you wouldn't get if you searched for /-s with a space).
    – David Knipe
    Nov 9 '17 at 20:31

















up vote
8
down vote













What I usually do in this case is just run man, search for the SHELL BUILTIN COMMANDS heading, then search for the builtin, i.e.



man bash
/^SHELL BUILTIN
/ read


however, in bash you can do



help read


or, depending on the system, either of



man 1 read
man bash-builtins


In general, I have a script called he ("short help") to do this. You would run it like this:



he bash read





share|improve this answer






















  • FYI, I renamed desc to he. github.com/mikelward/scripts/blob/master/he
    – Mikel
    Oct 4 '14 at 7:20

















up vote
3
down vote













There is no generic way to finding information in a man page, any more than there is a generic way of finding information in a book. It depends on what you're looking for.



When you're looking for information about a shell builtin, you can search for the builtin at the beginning of a line save for indentation, and followed by a space: search for ^ *read␣ (e.g. type /^ *read␣ Enter) (␣ is a space). This works with dash, pdksh, mksh and bash. Zsh's man page is split so you need to read the zshbuiltins man page. Ksh93 has special symbols before the names of some builtins, you need to search for ^ *†*␣ in UTF-8 or ^ *-*␣ in ASCII. There are a couple of false positives but this will get you quickly to the right line. Searching for ^ *read($| [-) reduces the amount of false positives.



You can speed up the search by telling your pager where you want to go. For example PAGER='less "+/^ *read ["' man bash opens the bash man page on the description of the read builtin. You can make this a function:



man-builtin () \[





share|improve this answer




















  • In the mksh manpage, / read (two spaces, command name, one space) usually finds the right spot (this is a trick I use myself, and is quick to type). Thanks for asking about it; I’ll put making (somewhat) separate references for all utilities included with mksh on my TODO.
    – mirabilos
    Feb 27 '14 at 14:12






  • 1




    @mirabilos / read tends to have a lot of false positives when your man implementation justifies the text.
    – Gilles
    Feb 27 '14 at 14:37










  • Agreed. Even more reason to really split off the builtin documentation.
    – mirabilos
    Feb 27 '14 at 14:40

















up vote
0
down vote













Just to offer another alternative, if you prefer using a web browser which allows you to easily search through the current page, you can use something like man.cgi used at freeBSD.org which also lets you view man pages from different systems to see how they differ. I have seen similar on other sites so expect there are other variations around.



The help link under apropos offers some info to get a copy of the script to put on your own server with links to download the man page collections.






share|improve this answer



























    up vote
    0
    down vote













    I got around to creating a bash function for the purpose. This snippet can be for example pasted at the end of ~/.bashrc:



    manfind() 
    # required args
    test "$1" -a "$2"


    Comments explain a bit about what it does. The default search string in particular searches given word from the beginning of lines, skipping initial space. Examples:



    # find every line which starts with 'read' followed by space
    manfind bash 'read '
    # research bash subshells
    manfind bash '.*subshell'


    Note: This script has no concept of man page sections... I'll see if I tweak that later, but setting MANSECT environment variable of man helps.






    share|improve this answer


















    • 2




      You might want to add a trap to clean up the temporary file: trap 'rm -f "$tmp"'
      – l0b0
      Oct 15 '13 at 12:34






    • 1




      This looks very complicated. I haven't fully read what your script does, but wouldn't man "$1" | vim -R - "+/$2" do something similar?
      – Gilles
      Oct 15 '13 at 19:15










    • @Gilles I that would go to first occurrence of $2, so no.
      – hyde
      Oct 16 '13 at 5:43










    • @l0b0 Changed cleanup to use trap. I didn't find a clean way to do it in a function without creating a subshell though.
      – hyde
      Oct 16 '13 at 7:03










    • @hyde Adapt the regex to what you're doing, of course. My point was about using +/REGEX
      – Gilles
      Oct 16 '13 at 9:06

















    up vote
    0
    down vote













    Putting together the pieces from the other discussion here here's a quick function you can leave in your .bashrc that will get you directly to the built-in (if it exists). Otherwise it opens man as normal:



    man() 
    case "$(/bin/bash -c 'type -t '"$1")" in
    builtin)
    LESS=+?"^ $1 " command -p man bash
    ;;
    *)
    command -p man $@
    ;;
    esac






    share|improve this answer





























      up vote
      0
      down vote













      From any Linux distro you should be able to use info bash if you want to have separate paragraphs by type of action where the information are identical to man pages.



      Hope this help.






      share|improve this answer





























        up vote
        0
        down vote













        To jump directly to the SHELL BUILTINS COMMANDS section of the bash man page, I define the following alias in my $HOME/.bash_aliases file.



        alias man-builtin="man -P 'less -p ^SHELL BUILTIN COMMANDS' bash"





        share|improve this answer








        New contributor




        trellem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.

















          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "",
          contentPolicyHtml: "",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f96095%2freading-and-searching-long-man-pages%23new-answer', 'question_page');

          );

          Post as a guest






























          9 Answers
          9






          active

          oldest

          votes








          9 Answers
          9






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          29
          down vote



          +50










          For quickly getting help on a Bash builtin, use help:



          help read


          is what you want.



          For man-page-like formatting, use



          help -m read


          or, even better,



          help -m read | less


          If you still insist on looking for it in the man page, I find what quickly gets me to a command's explanation is



          /^s*read [


          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 actual read 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:



          man -T dvi bash >bash.dvi


          or



          man -T ps bash | ps2pdf - bash.pdf # Requires the Ghostscript suite for ps2pdf


          Of course, given a DVI or PDF document, you can then do a text search easily.






          share|improve this answer






















          • Hmm, that help is great, I wonder how I've never heard of it... ps2pdf is not that useful since it can't (apparently) create index of any kind.
            – hyde
            Oct 15 '13 at 12:04










          • @hyde Not sure what you mean by creating an index, but have you heard of ptx?
            – Joseph R.
            Oct 15 '13 at 12:12











          • Index or Table of Contents, that "ptx" sounds exactly like what I meant.
            – hyde
            Oct 16 '13 at 7:06






          • 1




            Another, even simpler alternative is to do 'man bash > bashman.txt'. Then you can just open bashman.txt in (another) window in your text editor and use all of it's commands for finding what you want. You can even edit the file to add tags for the sections you refer to most often. Making bashman.txt read-only helps so you don't modify it by accident in your editor.
            – Joe
            Oct 20 '13 at 3:58










          • You can also open man pages in the browser of your choice and use all of its tools. See askubuntu.com/questions/339255/…
            – Joe
            Oct 20 '13 at 4:00














          up vote
          29
          down vote



          +50










          For quickly getting help on a Bash builtin, use help:



          help read


          is what you want.



          For man-page-like formatting, use



          help -m read


          or, even better,



          help -m read | less


          If you still insist on looking for it in the man page, I find what quickly gets me to a command's explanation is



          /^s*read [


          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 actual read 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:



          man -T dvi bash >bash.dvi


          or



          man -T ps bash | ps2pdf - bash.pdf # Requires the Ghostscript suite for ps2pdf


          Of course, given a DVI or PDF document, you can then do a text search easily.






          share|improve this answer






















          • Hmm, that help is great, I wonder how I've never heard of it... ps2pdf is not that useful since it can't (apparently) create index of any kind.
            – hyde
            Oct 15 '13 at 12:04










          • @hyde Not sure what you mean by creating an index, but have you heard of ptx?
            – Joseph R.
            Oct 15 '13 at 12:12











          • Index or Table of Contents, that "ptx" sounds exactly like what I meant.
            – hyde
            Oct 16 '13 at 7:06






          • 1




            Another, even simpler alternative is to do 'man bash > bashman.txt'. Then you can just open bashman.txt in (another) window in your text editor and use all of it's commands for finding what you want. You can even edit the file to add tags for the sections you refer to most often. Making bashman.txt read-only helps so you don't modify it by accident in your editor.
            – Joe
            Oct 20 '13 at 3:58










          • You can also open man pages in the browser of your choice and use all of its tools. See askubuntu.com/questions/339255/…
            – Joe
            Oct 20 '13 at 4:00












          up vote
          29
          down vote



          +50







          up vote
          29
          down vote



          +50




          +50




          For quickly getting help on a Bash builtin, use help:



          help read


          is what you want.



          For man-page-like formatting, use



          help -m read


          or, even better,



          help -m read | less


          If you still insist on looking for it in the man page, I find what quickly gets me to a command's explanation is



          /^s*read [


          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 actual read 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:



          man -T dvi bash >bash.dvi


          or



          man -T ps bash | ps2pdf - bash.pdf # Requires the Ghostscript suite for ps2pdf


          Of course, given a DVI or PDF document, you can then do a text search easily.






          share|improve this answer














          For quickly getting help on a Bash builtin, use help:



          help read


          is what you want.



          For man-page-like formatting, use



          help -m read


          or, even better,



          help -m read | less


          If you still insist on looking for it in the man page, I find what quickly gets me to a command's explanation is



          /^s*read [


          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 actual read 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:



          man -T dvi bash >bash.dvi


          or



          man -T ps bash | ps2pdf - bash.pdf # Requires the Ghostscript suite for ps2pdf


          Of course, given a DVI or PDF document, you can then do a text search easily.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 27 '15 at 10:34









          thecarpy

          2,235824




          2,235824










          answered Oct 15 '13 at 11:15









          Joseph R.

          27.5k369113




          27.5k369113











          • Hmm, that help is great, I wonder how I've never heard of it... ps2pdf is not that useful since it can't (apparently) create index of any kind.
            – hyde
            Oct 15 '13 at 12:04










          • @hyde Not sure what you mean by creating an index, but have you heard of ptx?
            – Joseph R.
            Oct 15 '13 at 12:12











          • Index or Table of Contents, that "ptx" sounds exactly like what I meant.
            – hyde
            Oct 16 '13 at 7:06






          • 1




            Another, even simpler alternative is to do 'man bash > bashman.txt'. Then you can just open bashman.txt in (another) window in your text editor and use all of it's commands for finding what you want. You can even edit the file to add tags for the sections you refer to most often. Making bashman.txt read-only helps so you don't modify it by accident in your editor.
            – Joe
            Oct 20 '13 at 3:58










          • You can also open man pages in the browser of your choice and use all of its tools. See askubuntu.com/questions/339255/…
            – Joe
            Oct 20 '13 at 4:00
















          • Hmm, that help is great, I wonder how I've never heard of it... ps2pdf is not that useful since it can't (apparently) create index of any kind.
            – hyde
            Oct 15 '13 at 12:04










          • @hyde Not sure what you mean by creating an index, but have you heard of ptx?
            – Joseph R.
            Oct 15 '13 at 12:12











          • Index or Table of Contents, that "ptx" sounds exactly like what I meant.
            – hyde
            Oct 16 '13 at 7:06






          • 1




            Another, even simpler alternative is to do 'man bash > bashman.txt'. Then you can just open bashman.txt in (another) window in your text editor and use all of it's commands for finding what you want. You can even edit the file to add tags for the sections you refer to most often. Making bashman.txt read-only helps so you don't modify it by accident in your editor.
            – Joe
            Oct 20 '13 at 3:58










          • You can also open man pages in the browser of your choice and use all of its tools. See askubuntu.com/questions/339255/…
            – Joe
            Oct 20 '13 at 4:00















          Hmm, that help is great, I wonder how I've never heard of it... ps2pdf is not that useful since it can't (apparently) create index of any kind.
          – hyde
          Oct 15 '13 at 12:04




          Hmm, that help is great, I wonder how I've never heard of it... ps2pdf is not that useful since it can't (apparently) create index of any kind.
          – hyde
          Oct 15 '13 at 12:04












          @hyde Not sure what you mean by creating an index, but have you heard of ptx?
          – Joseph R.
          Oct 15 '13 at 12:12





          @hyde Not sure what you mean by creating an index, but have you heard of ptx?
          – Joseph R.
          Oct 15 '13 at 12:12













          Index or Table of Contents, that "ptx" sounds exactly like what I meant.
          – hyde
          Oct 16 '13 at 7:06




          Index or Table of Contents, that "ptx" sounds exactly like what I meant.
          – hyde
          Oct 16 '13 at 7:06




          1




          1




          Another, even simpler alternative is to do 'man bash > bashman.txt'. Then you can just open bashman.txt in (another) window in your text editor and use all of it's commands for finding what you want. You can even edit the file to add tags for the sections you refer to most often. Making bashman.txt read-only helps so you don't modify it by accident in your editor.
          – Joe
          Oct 20 '13 at 3:58




          Another, even simpler alternative is to do 'man bash > bashman.txt'. Then you can just open bashman.txt in (another) window in your text editor and use all of it's commands for finding what you want. You can even edit the file to add tags for the sections you refer to most often. Making bashman.txt read-only helps so you don't modify it by accident in your editor.
          – Joe
          Oct 20 '13 at 3:58












          You can also open man pages in the browser of your choice and use all of its tools. See askubuntu.com/questions/339255/…
          – Joe
          Oct 20 '13 at 4:00




          You can also open man pages in the browser of your choice and use all of its tools. See askubuntu.com/questions/339255/…
          – Joe
          Oct 20 '13 at 4:00












          up vote
          9
          down vote













          Approach 1



          man bash then /read [ then /-s



          Approach 2



          You may try an open source tool for explaining command-line arguments called explainshell.



          It can be used locally. Read documentation on https://github.com/idank/explainshell



          Caveats: Usually works, but only with commands found in Ubuntu's manpage repository



          In your case, it cannot recognize -s switch in read -s pwd.



          Approach 3



          I have found another tool that seems promising but it does not work on my system.



          explain: Short Documentation for Unix Commands






          share|improve this answer






















          • Interesting links, thanks!
            – hyde
            Oct 15 '13 at 10:40










          • With approach 1, you can do /-sb to avoid hits like --some-other-command (while still finding strings such as -s,, which you wouldn't get if you searched for /-s with a space).
            – David Knipe
            Nov 9 '17 at 20:31














          up vote
          9
          down vote













          Approach 1



          man bash then /read [ then /-s



          Approach 2



          You may try an open source tool for explaining command-line arguments called explainshell.



          It can be used locally. Read documentation on https://github.com/idank/explainshell



          Caveats: Usually works, but only with commands found in Ubuntu's manpage repository



          In your case, it cannot recognize -s switch in read -s pwd.



          Approach 3



          I have found another tool that seems promising but it does not work on my system.



          explain: Short Documentation for Unix Commands






          share|improve this answer






















          • Interesting links, thanks!
            – hyde
            Oct 15 '13 at 10:40










          • With approach 1, you can do /-sb to avoid hits like --some-other-command (while still finding strings such as -s,, which you wouldn't get if you searched for /-s with a space).
            – David Knipe
            Nov 9 '17 at 20:31












          up vote
          9
          down vote










          up vote
          9
          down vote









          Approach 1



          man bash then /read [ then /-s



          Approach 2



          You may try an open source tool for explaining command-line arguments called explainshell.



          It can be used locally. Read documentation on https://github.com/idank/explainshell



          Caveats: Usually works, but only with commands found in Ubuntu's manpage repository



          In your case, it cannot recognize -s switch in read -s pwd.



          Approach 3



          I have found another tool that seems promising but it does not work on my system.



          explain: Short Documentation for Unix Commands






          share|improve this answer














          Approach 1



          man bash then /read [ then /-s



          Approach 2



          You may try an open source tool for explaining command-line arguments called explainshell.



          It can be used locally. Read documentation on https://github.com/idank/explainshell



          Caveats: Usually works, but only with commands found in Ubuntu's manpage repository



          In your case, it cannot recognize -s switch in read -s pwd.



          Approach 3



          I have found another tool that seems promising but it does not work on my system.



          explain: Short Documentation for Unix Commands







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 5 '15 at 6:09

























          answered Oct 15 '13 at 9:54









          Ivan Chau

          460412




          460412











          • Interesting links, thanks!
            – hyde
            Oct 15 '13 at 10:40










          • With approach 1, you can do /-sb to avoid hits like --some-other-command (while still finding strings such as -s,, which you wouldn't get if you searched for /-s with a space).
            – David Knipe
            Nov 9 '17 at 20:31
















          • Interesting links, thanks!
            – hyde
            Oct 15 '13 at 10:40










          • With approach 1, you can do /-sb to avoid hits like --some-other-command (while still finding strings such as -s,, which you wouldn't get if you searched for /-s with a space).
            – David Knipe
            Nov 9 '17 at 20:31















          Interesting links, thanks!
          – hyde
          Oct 15 '13 at 10:40




          Interesting links, thanks!
          – hyde
          Oct 15 '13 at 10:40












          With approach 1, you can do /-sb to avoid hits like --some-other-command (while still finding strings such as -s,, which you wouldn't get if you searched for /-s with a space).
          – David Knipe
          Nov 9 '17 at 20:31




          With approach 1, you can do /-sb to avoid hits like --some-other-command (while still finding strings such as -s,, which you wouldn't get if you searched for /-s with a space).
          – David Knipe
          Nov 9 '17 at 20:31










          up vote
          8
          down vote













          What I usually do in this case is just run man, search for the SHELL BUILTIN COMMANDS heading, then search for the builtin, i.e.



          man bash
          /^SHELL BUILTIN
          / read


          however, in bash you can do



          help read


          or, depending on the system, either of



          man 1 read
          man bash-builtins


          In general, I have a script called he ("short help") to do this. You would run it like this:



          he bash read





          share|improve this answer






















          • FYI, I renamed desc to he. github.com/mikelward/scripts/blob/master/he
            – Mikel
            Oct 4 '14 at 7:20














          up vote
          8
          down vote













          What I usually do in this case is just run man, search for the SHELL BUILTIN COMMANDS heading, then search for the builtin, i.e.



          man bash
          /^SHELL BUILTIN
          / read


          however, in bash you can do



          help read


          or, depending on the system, either of



          man 1 read
          man bash-builtins


          In general, I have a script called he ("short help") to do this. You would run it like this:



          he bash read





          share|improve this answer






















          • FYI, I renamed desc to he. github.com/mikelward/scripts/blob/master/he
            – Mikel
            Oct 4 '14 at 7:20












          up vote
          8
          down vote










          up vote
          8
          down vote









          What I usually do in this case is just run man, search for the SHELL BUILTIN COMMANDS heading, then search for the builtin, i.e.



          man bash
          /^SHELL BUILTIN
          / read


          however, in bash you can do



          help read


          or, depending on the system, either of



          man 1 read
          man bash-builtins


          In general, I have a script called he ("short help") to do this. You would run it like this:



          he bash read





          share|improve this answer














          What I usually do in this case is just run man, search for the SHELL BUILTIN COMMANDS heading, then search for the builtin, i.e.



          man bash
          /^SHELL BUILTIN
          / read


          however, in bash you can do



          help read


          or, depending on the system, either of



          man 1 read
          man bash-builtins


          In general, I have a script called he ("short help") to do this. You would run it like this:



          he bash read






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 2 '14 at 18:02

























          answered Oct 15 '13 at 19:24









          Mikel

          38.3k997125




          38.3k997125











          • FYI, I renamed desc to he. github.com/mikelward/scripts/blob/master/he
            – Mikel
            Oct 4 '14 at 7:20
















          • FYI, I renamed desc to he. github.com/mikelward/scripts/blob/master/he
            – Mikel
            Oct 4 '14 at 7:20















          FYI, I renamed desc to he. github.com/mikelward/scripts/blob/master/he
          – Mikel
          Oct 4 '14 at 7:20




          FYI, I renamed desc to he. github.com/mikelward/scripts/blob/master/he
          – Mikel
          Oct 4 '14 at 7:20










          up vote
          3
          down vote













          There is no generic way to finding information in a man page, any more than there is a generic way of finding information in a book. It depends on what you're looking for.



          When you're looking for information about a shell builtin, you can search for the builtin at the beginning of a line save for indentation, and followed by a space: search for ^ *read␣ (e.g. type /^ *read␣ Enter) (␣ is a space). This works with dash, pdksh, mksh and bash. Zsh's man page is split so you need to read the zshbuiltins man page. Ksh93 has special symbols before the names of some builtins, you need to search for ^ *†*␣ in UTF-8 or ^ *-*␣ in ASCII. There are a couple of false positives but this will get you quickly to the right line. Searching for ^ *read($| [-) reduces the amount of false positives.



          You can speed up the search by telling your pager where you want to go. For example PAGER='less "+/^ *read ["' man bash opens the bash man page on the description of the read builtin. You can make this a function:



          man-builtin () \[





          share|improve this answer




















          • In the mksh manpage, / read (two spaces, command name, one space) usually finds the right spot (this is a trick I use myself, and is quick to type). Thanks for asking about it; I’ll put making (somewhat) separate references for all utilities included with mksh on my TODO.
            – mirabilos
            Feb 27 '14 at 14:12






          • 1




            @mirabilos / read tends to have a lot of false positives when your man implementation justifies the text.
            – Gilles
            Feb 27 '14 at 14:37










          • Agreed. Even more reason to really split off the builtin documentation.
            – mirabilos
            Feb 27 '14 at 14:40














          up vote
          3
          down vote













          There is no generic way to finding information in a man page, any more than there is a generic way of finding information in a book. It depends on what you're looking for.



          When you're looking for information about a shell builtin, you can search for the builtin at the beginning of a line save for indentation, and followed by a space: search for ^ *read␣ (e.g. type /^ *read␣ Enter) (␣ is a space). This works with dash, pdksh, mksh and bash. Zsh's man page is split so you need to read the zshbuiltins man page. Ksh93 has special symbols before the names of some builtins, you need to search for ^ *†*␣ in UTF-8 or ^ *-*␣ in ASCII. There are a couple of false positives but this will get you quickly to the right line. Searching for ^ *read($| [-) reduces the amount of false positives.



          You can speed up the search by telling your pager where you want to go. For example PAGER='less "+/^ *read ["' man bash opens the bash man page on the description of the read builtin. You can make this a function:



          man-builtin () \[





          share|improve this answer




















          • In the mksh manpage, / read (two spaces, command name, one space) usually finds the right spot (this is a trick I use myself, and is quick to type). Thanks for asking about it; I’ll put making (somewhat) separate references for all utilities included with mksh on my TODO.
            – mirabilos
            Feb 27 '14 at 14:12






          • 1




            @mirabilos / read tends to have a lot of false positives when your man implementation justifies the text.
            – Gilles
            Feb 27 '14 at 14:37










          • Agreed. Even more reason to really split off the builtin documentation.
            – mirabilos
            Feb 27 '14 at 14:40












          up vote
          3
          down vote










          up vote
          3
          down vote









          There is no generic way to finding information in a man page, any more than there is a generic way of finding information in a book. It depends on what you're looking for.



          When you're looking for information about a shell builtin, you can search for the builtin at the beginning of a line save for indentation, and followed by a space: search for ^ *read␣ (e.g. type /^ *read␣ Enter) (␣ is a space). This works with dash, pdksh, mksh and bash. Zsh's man page is split so you need to read the zshbuiltins man page. Ksh93 has special symbols before the names of some builtins, you need to search for ^ *†*␣ in UTF-8 or ^ *-*␣ in ASCII. There are a couple of false positives but this will get you quickly to the right line. Searching for ^ *read($| [-) reduces the amount of false positives.



          You can speed up the search by telling your pager where you want to go. For example PAGER='less "+/^ *read ["' man bash opens the bash man page on the description of the read builtin. You can make this a function:



          man-builtin () \[





          share|improve this answer












          There is no generic way to finding information in a man page, any more than there is a generic way of finding information in a book. It depends on what you're looking for.



          When you're looking for information about a shell builtin, you can search for the builtin at the beginning of a line save for indentation, and followed by a space: search for ^ *read␣ (e.g. type /^ *read␣ Enter) (␣ is a space). This works with dash, pdksh, mksh and bash. Zsh's man page is split so you need to read the zshbuiltins man page. Ksh93 has special symbols before the names of some builtins, you need to search for ^ *†*␣ in UTF-8 or ^ *-*␣ in ASCII. There are a couple of false positives but this will get you quickly to the right line. Searching for ^ *read($| [-) reduces the amount of false positives.



          You can speed up the search by telling your pager where you want to go. For example PAGER='less "+/^ *read ["' man bash opens the bash man page on the description of the read builtin. You can make this a function:



          man-builtin () \[






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 16 '13 at 0:51









          Gilles

          517k12310311559




          517k12310311559











          • In the mksh manpage, / read (two spaces, command name, one space) usually finds the right spot (this is a trick I use myself, and is quick to type). Thanks for asking about it; I’ll put making (somewhat) separate references for all utilities included with mksh on my TODO.
            – mirabilos
            Feb 27 '14 at 14:12






          • 1




            @mirabilos / read tends to have a lot of false positives when your man implementation justifies the text.
            – Gilles
            Feb 27 '14 at 14:37










          • Agreed. Even more reason to really split off the builtin documentation.
            – mirabilos
            Feb 27 '14 at 14:40
















          • In the mksh manpage, / read (two spaces, command name, one space) usually finds the right spot (this is a trick I use myself, and is quick to type). Thanks for asking about it; I’ll put making (somewhat) separate references for all utilities included with mksh on my TODO.
            – mirabilos
            Feb 27 '14 at 14:12






          • 1




            @mirabilos / read tends to have a lot of false positives when your man implementation justifies the text.
            – Gilles
            Feb 27 '14 at 14:37










          • Agreed. Even more reason to really split off the builtin documentation.
            – mirabilos
            Feb 27 '14 at 14:40















          In the mksh manpage, / read (two spaces, command name, one space) usually finds the right spot (this is a trick I use myself, and is quick to type). Thanks for asking about it; I’ll put making (somewhat) separate references for all utilities included with mksh on my TODO.
          – mirabilos
          Feb 27 '14 at 14:12




          In the mksh manpage, / read (two spaces, command name, one space) usually finds the right spot (this is a trick I use myself, and is quick to type). Thanks for asking about it; I’ll put making (somewhat) separate references for all utilities included with mksh on my TODO.
          – mirabilos
          Feb 27 '14 at 14:12




          1




          1




          @mirabilos / read tends to have a lot of false positives when your man implementation justifies the text.
          – Gilles
          Feb 27 '14 at 14:37




          @mirabilos / read tends to have a lot of false positives when your man implementation justifies the text.
          – Gilles
          Feb 27 '14 at 14:37












          Agreed. Even more reason to really split off the builtin documentation.
          – mirabilos
          Feb 27 '14 at 14:40




          Agreed. Even more reason to really split off the builtin documentation.
          – mirabilos
          Feb 27 '14 at 14:40










          up vote
          0
          down vote













          Just to offer another alternative, if you prefer using a web browser which allows you to easily search through the current page, you can use something like man.cgi used at freeBSD.org which also lets you view man pages from different systems to see how they differ. I have seen similar on other sites so expect there are other variations around.



          The help link under apropos offers some info to get a copy of the script to put on your own server with links to download the man page collections.






          share|improve this answer
























            up vote
            0
            down vote













            Just to offer another alternative, if you prefer using a web browser which allows you to easily search through the current page, you can use something like man.cgi used at freeBSD.org which also lets you view man pages from different systems to see how they differ. I have seen similar on other sites so expect there are other variations around.



            The help link under apropos offers some info to get a copy of the script to put on your own server with links to download the man page collections.






            share|improve this answer






















              up vote
              0
              down vote










              up vote
              0
              down vote









              Just to offer another alternative, if you prefer using a web browser which allows you to easily search through the current page, you can use something like man.cgi used at freeBSD.org which also lets you view man pages from different systems to see how they differ. I have seen similar on other sites so expect there are other variations around.



              The help link under apropos offers some info to get a copy of the script to put on your own server with links to download the man page collections.






              share|improve this answer












              Just to offer another alternative, if you prefer using a web browser which allows you to easily search through the current page, you can use something like man.cgi used at freeBSD.org which also lets you view man pages from different systems to see how they differ. I have seen similar on other sites so expect there are other variations around.



              The help link under apropos offers some info to get a copy of the script to put on your own server with links to download the man page collections.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Oct 16 '13 at 4:13









              sambler

              31014




              31014




















                  up vote
                  0
                  down vote













                  I got around to creating a bash function for the purpose. This snippet can be for example pasted at the end of ~/.bashrc:



                  manfind() 
                  # required args
                  test "$1" -a "$2"


                  Comments explain a bit about what it does. The default search string in particular searches given word from the beginning of lines, skipping initial space. Examples:



                  # find every line which starts with 'read' followed by space
                  manfind bash 'read '
                  # research bash subshells
                  manfind bash '.*subshell'


                  Note: This script has no concept of man page sections... I'll see if I tweak that later, but setting MANSECT environment variable of man helps.






                  share|improve this answer


















                  • 2




                    You might want to add a trap to clean up the temporary file: trap 'rm -f "$tmp"'
                    – l0b0
                    Oct 15 '13 at 12:34






                  • 1




                    This looks very complicated. I haven't fully read what your script does, but wouldn't man "$1" | vim -R - "+/$2" do something similar?
                    – Gilles
                    Oct 15 '13 at 19:15










                  • @Gilles I that would go to first occurrence of $2, so no.
                    – hyde
                    Oct 16 '13 at 5:43










                  • @l0b0 Changed cleanup to use trap. I didn't find a clean way to do it in a function without creating a subshell though.
                    – hyde
                    Oct 16 '13 at 7:03










                  • @hyde Adapt the regex to what you're doing, of course. My point was about using +/REGEX
                    – Gilles
                    Oct 16 '13 at 9:06














                  up vote
                  0
                  down vote













                  I got around to creating a bash function for the purpose. This snippet can be for example pasted at the end of ~/.bashrc:



                  manfind() 
                  # required args
                  test "$1" -a "$2"


                  Comments explain a bit about what it does. The default search string in particular searches given word from the beginning of lines, skipping initial space. Examples:



                  # find every line which starts with 'read' followed by space
                  manfind bash 'read '
                  # research bash subshells
                  manfind bash '.*subshell'


                  Note: This script has no concept of man page sections... I'll see if I tweak that later, but setting MANSECT environment variable of man helps.






                  share|improve this answer


















                  • 2




                    You might want to add a trap to clean up the temporary file: trap 'rm -f "$tmp"'
                    – l0b0
                    Oct 15 '13 at 12:34






                  • 1




                    This looks very complicated. I haven't fully read what your script does, but wouldn't man "$1" | vim -R - "+/$2" do something similar?
                    – Gilles
                    Oct 15 '13 at 19:15










                  • @Gilles I that would go to first occurrence of $2, so no.
                    – hyde
                    Oct 16 '13 at 5:43










                  • @l0b0 Changed cleanup to use trap. I didn't find a clean way to do it in a function without creating a subshell though.
                    – hyde
                    Oct 16 '13 at 7:03










                  • @hyde Adapt the regex to what you're doing, of course. My point was about using +/REGEX
                    – Gilles
                    Oct 16 '13 at 9:06












                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  I got around to creating a bash function for the purpose. This snippet can be for example pasted at the end of ~/.bashrc:



                  manfind() 
                  # required args
                  test "$1" -a "$2"


                  Comments explain a bit about what it does. The default search string in particular searches given word from the beginning of lines, skipping initial space. Examples:



                  # find every line which starts with 'read' followed by space
                  manfind bash 'read '
                  # research bash subshells
                  manfind bash '.*subshell'


                  Note: This script has no concept of man page sections... I'll see if I tweak that later, but setting MANSECT environment variable of man helps.






                  share|improve this answer














                  I got around to creating a bash function for the purpose. This snippet can be for example pasted at the end of ~/.bashrc:



                  manfind() 
                  # required args
                  test "$1" -a "$2"


                  Comments explain a bit about what it does. The default search string in particular searches given word from the beginning of lines, skipping initial space. Examples:



                  # find every line which starts with 'read' followed by space
                  manfind bash 'read '
                  # research bash subshells
                  manfind bash '.*subshell'


                  Note: This script has no concept of man page sections... I'll see if I tweak that later, but setting MANSECT environment variable of man helps.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Oct 16 '13 at 7:17

























                  answered Oct 15 '13 at 10:35









                  hyde

                  4961516




                  4961516







                  • 2




                    You might want to add a trap to clean up the temporary file: trap 'rm -f "$tmp"'
                    – l0b0
                    Oct 15 '13 at 12:34






                  • 1




                    This looks very complicated. I haven't fully read what your script does, but wouldn't man "$1" | vim -R - "+/$2" do something similar?
                    – Gilles
                    Oct 15 '13 at 19:15










                  • @Gilles I that would go to first occurrence of $2, so no.
                    – hyde
                    Oct 16 '13 at 5:43










                  • @l0b0 Changed cleanup to use trap. I didn't find a clean way to do it in a function without creating a subshell though.
                    – hyde
                    Oct 16 '13 at 7:03










                  • @hyde Adapt the regex to what you're doing, of course. My point was about using +/REGEX
                    – Gilles
                    Oct 16 '13 at 9:06












                  • 2




                    You might want to add a trap to clean up the temporary file: trap 'rm -f "$tmp"'
                    – l0b0
                    Oct 15 '13 at 12:34






                  • 1




                    This looks very complicated. I haven't fully read what your script does, but wouldn't man "$1" | vim -R - "+/$2" do something similar?
                    – Gilles
                    Oct 15 '13 at 19:15










                  • @Gilles I that would go to first occurrence of $2, so no.
                    – hyde
                    Oct 16 '13 at 5:43










                  • @l0b0 Changed cleanup to use trap. I didn't find a clean way to do it in a function without creating a subshell though.
                    – hyde
                    Oct 16 '13 at 7:03










                  • @hyde Adapt the regex to what you're doing, of course. My point was about using +/REGEX
                    – Gilles
                    Oct 16 '13 at 9:06







                  2




                  2




                  You might want to add a trap to clean up the temporary file: trap 'rm -f "$tmp"'
                  – l0b0
                  Oct 15 '13 at 12:34




                  You might want to add a trap to clean up the temporary file: trap 'rm -f "$tmp"'
                  – l0b0
                  Oct 15 '13 at 12:34




                  1




                  1




                  This looks very complicated. I haven't fully read what your script does, but wouldn't man "$1" | vim -R - "+/$2" do something similar?
                  – Gilles
                  Oct 15 '13 at 19:15




                  This looks very complicated. I haven't fully read what your script does, but wouldn't man "$1" | vim -R - "+/$2" do something similar?
                  – Gilles
                  Oct 15 '13 at 19:15












                  @Gilles I that would go to first occurrence of $2, so no.
                  – hyde
                  Oct 16 '13 at 5:43




                  @Gilles I that would go to first occurrence of $2, so no.
                  – hyde
                  Oct 16 '13 at 5:43












                  @l0b0 Changed cleanup to use trap. I didn't find a clean way to do it in a function without creating a subshell though.
                  – hyde
                  Oct 16 '13 at 7:03




                  @l0b0 Changed cleanup to use trap. I didn't find a clean way to do it in a function without creating a subshell though.
                  – hyde
                  Oct 16 '13 at 7:03












                  @hyde Adapt the regex to what you're doing, of course. My point was about using +/REGEX
                  – Gilles
                  Oct 16 '13 at 9:06




                  @hyde Adapt the regex to what you're doing, of course. My point was about using +/REGEX
                  – Gilles
                  Oct 16 '13 at 9:06










                  up vote
                  0
                  down vote













                  Putting together the pieces from the other discussion here here's a quick function you can leave in your .bashrc that will get you directly to the built-in (if it exists). Otherwise it opens man as normal:



                  man() 
                  case "$(/bin/bash -c 'type -t '"$1")" in
                  builtin)
                  LESS=+?"^ $1 " command -p man bash
                  ;;
                  *)
                  command -p man $@
                  ;;
                  esac






                  share|improve this answer


























                    up vote
                    0
                    down vote













                    Putting together the pieces from the other discussion here here's a quick function you can leave in your .bashrc that will get you directly to the built-in (if it exists). Otherwise it opens man as normal:



                    man() 
                    case "$(/bin/bash -c 'type -t '"$1")" in
                    builtin)
                    LESS=+?"^ $1 " command -p man bash
                    ;;
                    *)
                    command -p man $@
                    ;;
                    esac






                    share|improve this answer
























                      up vote
                      0
                      down vote










                      up vote
                      0
                      down vote









                      Putting together the pieces from the other discussion here here's a quick function you can leave in your .bashrc that will get you directly to the built-in (if it exists). Otherwise it opens man as normal:



                      man() 
                      case "$(/bin/bash -c 'type -t '"$1")" in
                      builtin)
                      LESS=+?"^ $1 " command -p man bash
                      ;;
                      *)
                      command -p man $@
                      ;;
                      esac






                      share|improve this answer














                      Putting together the pieces from the other discussion here here's a quick function you can leave in your .bashrc that will get you directly to the built-in (if it exists). Otherwise it opens man as normal:



                      man() 
                      case "$(/bin/bash -c 'type -t '"$1")" in
                      builtin)
                      LESS=+?"^ $1 " command -p man bash
                      ;;
                      *)
                      command -p man $@
                      ;;
                      esac







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Apr 13 '17 at 12:36









                      Community♦

                      1




                      1










                      answered Apr 9 '15 at 10:39









                      Nik V

                      1




                      1




















                          up vote
                          0
                          down vote













                          From any Linux distro you should be able to use info bash if you want to have separate paragraphs by type of action where the information are identical to man pages.



                          Hope this help.






                          share|improve this answer


























                            up vote
                            0
                            down vote













                            From any Linux distro you should be able to use info bash if you want to have separate paragraphs by type of action where the information are identical to man pages.



                            Hope this help.






                            share|improve this answer
























                              up vote
                              0
                              down vote










                              up vote
                              0
                              down vote









                              From any Linux distro you should be able to use info bash if you want to have separate paragraphs by type of action where the information are identical to man pages.



                              Hope this help.






                              share|improve this answer














                              From any Linux distro you should be able to use info bash if you want to have separate paragraphs by type of action where the information are identical to man pages.



                              Hope this help.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Nov 14 '17 at 16:20

























                              answered Nov 14 '17 at 15:20









                              admstg

                              344




                              344




















                                  up vote
                                  0
                                  down vote













                                  To jump directly to the SHELL BUILTINS COMMANDS section of the bash man page, I define the following alias in my $HOME/.bash_aliases file.



                                  alias man-builtin="man -P 'less -p ^SHELL BUILTIN COMMANDS' bash"





                                  share|improve this answer








                                  New contributor




                                  trellem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                  Check out our Code of Conduct.





















                                    up vote
                                    0
                                    down vote













                                    To jump directly to the SHELL BUILTINS COMMANDS section of the bash man page, I define the following alias in my $HOME/.bash_aliases file.



                                    alias man-builtin="man -P 'less -p ^SHELL BUILTIN COMMANDS' bash"





                                    share|improve this answer








                                    New contributor




                                    trellem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.



















                                      up vote
                                      0
                                      down vote










                                      up vote
                                      0
                                      down vote









                                      To jump directly to the SHELL BUILTINS COMMANDS section of the bash man page, I define the following alias in my $HOME/.bash_aliases file.



                                      alias man-builtin="man -P 'less -p ^SHELL BUILTIN COMMANDS' bash"





                                      share|improve this answer








                                      New contributor




                                      trellem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.









                                      To jump directly to the SHELL BUILTINS COMMANDS section of the bash man page, I define the following alias in my $HOME/.bash_aliases file.



                                      alias man-builtin="man -P 'less -p ^SHELL BUILTIN COMMANDS' bash"






                                      share|improve this answer








                                      New contributor




                                      trellem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.









                                      share|improve this answer



                                      share|improve this answer






                                      New contributor




                                      trellem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.









                                      answered 12 mins ago









                                      trellem

                                      12




                                      12




                                      New contributor




                                      trellem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.





                                      New contributor





                                      trellem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.






                                      trellem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.



























                                           

                                          draft saved


                                          draft discarded















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f96095%2freading-and-searching-long-man-pages%23new-answer', 'question_page');

                                          );

                                          Post as a guest













































































                                          Popular posts from this blog

                                          How to check contact read email or not when send email to Individual?

                                          Bahrain

                                          Postfix configuration issue with fips on centos 7; mailgun relay