franklsf95
franklsf95

Reputation: 1252

Where to view man pages for Bash builtin commands?

For example, when I type man fg, or man history, the same manpage, BUILTIN(1) will be displayed. There is a list of commands, but not the specification of their usage. Where can I find them?

Upvotes: 27

Views: 4316

Answers (5)

Ativerc
Ativerc

Reputation: 103

There are 3 commands to find more information about shell builtins.

type <command> - Tells you what type of a command it is. Fun fact, type is a shell builtin as well. Type type type and hit enter and see more details.

help - Lists some shell builtin commands by default.

help <command> - Gives more information about <command>

info - This is kind of the man page for shell builtins. Its CLI, of course, but it's hyperlinked. However, it's hard to navigate and it usually takes me around 5 minutes to get a hang of it. Type info and read from the first line.

Upvotes: 0

Donentolon
Donentolon

Reputation: 1571

On zsh, the answers above aren't very helpful.

You can look at the shell's own manual with man zsh. It will tell you that the manual is too long (hah!) and provide a list of sections with the actual content. From there we learn that man zshbuiltins explains built-in commands. It's a huge listing each one and its explanation, you can search with /.

Upvotes: 11

Digital Trauma
Digital Trauma

Reputation: 15996

I have the following bash function defined in my ~/.bashrc:

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

This allows me to (in most cases) jump directly to the relevant section of the man page for the given builtin. E.g.

bashman fg

jumps directly to:

   fg [jobspec]
          Resume  jobspec  in the foreground, and make it the current job.
          If jobspec is not present, the shell's notion of the current job
          ...

Unfortunately it doesn't work quite so well for some builtins - history is one of them. In those cases, you will have to n through the man page several times to get to the required section.

Upvotes: 13

ThatOneDude
ThatOneDude

Reputation: 1526

Documentation for commands that are shell builtins are with the man pages for the shell.

See for example: man bash for the history or fg command.

Upvotes: 3

anubhava
anubhava

Reputation: 785058

BUILTIN commands don't have separate man pages. Those are covered by help pages. You can do:

help history

or

help fg

Upvotes: 26

Related Questions