So it seems that typing man git init
into a bash prompt on an Ubuntu 14.04 system does the same as man git-init
, only I'm not quite sure how.
The man
page for man
(i.e. man man
) doesn't seem to allow for this construct, unless git
was a section
of the manual, but the man page seems to come from section 1
.
Is this an undocumented usage supported by man
? Have I misunderstood the documentation of man
? Is some other magic happening? Anyone care to explain?
Best Answer
Some implementations of
man
, including the one used by Ubuntu, replace spaces in its search terms with hyphens and attempt to find a manual page under that name. Soman git init
looks for the same thing asman git-init
. Similarly,man run parts
andman ntfs 3g
work (if you haverun-parts
andntfs-3g
on your system).It only does this with word pairs, though, so
man git annex sync
does not work (thoughman git-annex sync
does, as that's again a word pair).In fact, when you ask for two manual pages (e.g.,
man git bash
to see both the git and bash manpages),man
actually first tries to look for agit-bash
manpage. You can see this in the debug output if you enable it with-d
.This man feature is called "subpages" you can read the source code implementing subpages in man-db (thanks, Stephen Kitt). Searching the
man(1)
manpage for "subpages" will also lead you to the description of this behavior under the--no-subpages
option: