Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

Is there anywhere you can download a manpage for every builtin commands?

I know you can just use help or man bash and search to find info about it, but I want them separated, so I can just do man read and get the read manpage.

share|improve this question

marked as duplicate by Gilles, Anthon, jasonwryan, Braiam, slm Apr 7 at 22:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
It's not quite what you want, but on my Fedora 15 system, these are separated into separate man pages which reference a builtins (1) man page. This is still a big aggregate document, but at least it's just the builtins and not everything to do with bash. –  mattdm Aug 4 '11 at 20:45
    
Doesn't work in Mac OS X –  Tyilo Aug 4 '11 at 20:49
    
Nor does man builtins work on linux mint. –  suspectus Jan 29 at 11:04
add comment

2 Answers 2

up vote 7 down vote accepted

Try this:

bashman () { man bash | less -p "^       $1 "; }

You may have to hit n a couple of times to get to the actual command instead of a paragraph that happens to have the command name as the first word.

share|improve this answer
    
Good idea. Not what I think Tyilo wants, but I'm not convinced I got that right. –  Gilles Aug 4 '11 at 23:32
1  
Works perfect! Adding a space after $1 makes it better –  Tyilo Aug 4 '11 at 23:35
    
You can also use LESS=-p"^ $1 " man bash. That way, you're not stripping any escape sequences. –  paraxor Jul 23 '13 at 1:03
add comment
help read
help read | less

In zsh:

run-help read

or type read something and press M-h (i.e. Alt+h or ESC h).

If you want to have a single man command so as not to need to know whether the command is a built-in, define this function in your ~/.bashrc:

man () {
  case "$(type -t "$1"):$1" in
    builtin:*) help "$1" | "${PAGER:-less}";;     # built-in
    *[[?*]*) help "$1" | "${PAGER:-less}";;       # pattern
    *) command -p man "$@";;  # something else, presumed to be an external command
                              # or options for the man command or a section number
  esac
}
share|improve this answer
    
@Tyilo help read does show what the options do. If the difference bothers you so much, switch to zsh, where run-help shows the same text that's in the man page. –  Gilles Aug 4 '11 at 21:05
    
I just want to download the manpages somewhere, not use some weird command to simulate it. Alternative, I want to extract all the builtin functions from the bash manual and create a new manpage for each of them. –  Tyilo Aug 4 '11 at 21:10
3  
@Tyilo, you could show a little respect for people trying to help you. –  glenn jackman Aug 4 '11 at 23:12
    
@Tyilo I suggest clarifying your question. I think I understand what you're after from your comment here, but it's not what glenn and I understood from your question. Rather than speculate on what you'll really after, I'll let you edit your question if you really want it answered to your satisfaction. –  Gilles Aug 4 '11 at 23:31
    
man () Fantastic.. very handy... thanks –  Peter.O Aug 6 '11 at 6:23
show 2 more comments

Not the answer you're looking for? Browse other questions tagged or ask your own question.