Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 '14 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 '14 at 11:04
up vote 12 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
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. – Evan Teitelman Jul 23 '13 at 1:03
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
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
@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

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