I use the man
command all the time when I want to get information about a specific command. But this doesn't help me too much when that specific command is a shell builtin. For example:
man cd
returns:
No manual entry for cd
My question is: it is possible to make man
also work for all shell builtin commands (like cd
, alias
, history
, etc.), and keywords (like if
, while
, [[
, {
, etc.)?
Best Answer
The
help
command when is used with-m
option can display information about builtin commands in pseudo-manpage format. For example:will display information about
cd
command in a format almost exactly like in a manual page.Starting from this command you can wrap
man
command in one function in your.bashrc
file as follow:After this
man
will work also for all shell builtin commands and keywords. For example:will display: