Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 762
franklsf95 Avatar asked Apr 10 '14 15:04

franklsf95


People also ask

How do I see man pages in Linux?

How to Open the Manual. To use man , you type man on the command line, followed by a space and a Linux command. man opens the Linux manual to the “man page” that describes that command—if it can find it, of course. The man page for man opens.

What command should be used to view a man page?

To view all the man pages for a particular topic, use the “-a” option. You'll see the lowest-number man page first. When you exit that page, and press “Enter” the next man page will appear. The above command will display the man page of printf(1) command first.

Which of the following is a built-in bash command?

bash defines the following built-in commands: :, ., [, alias, bg, bind, break, builtin, case, cd, command, compgen, complete, continue, declare, dirs, disown, echo, enable, eval, exec, exit, export, fc, fg, getopts, hash, help, history, if, jobs, kill, let, local, logout, popd, printf, pushd, pwd, read, readonly, ...

What are the shell built-in commands?

In computing, a shell builtin is a command or a function, called from a shell, that is executed directly in the shell itself, instead of an external executable program which the shell would load and execute. Shell builtins work significantly faster than external programs, because there is no program loading overhead.


2 Answers

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

help history

or

help fg
like image 167
anubhava Avatar answered Nov 15 '22 13:11

anubhava


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

like image 20
Digital Trauma Avatar answered Nov 15 '22 15:11

Digital Trauma