Online man pages in HTML with section anchors?

It would be good to have an online version of the Ubuntu man pages with direct links into subsections. That would allow to point someone to the relevant documentation in many cases - for example in answers of various StackExchange sites.

I will describe how a full solution might look, and in which ways that would be useful. I do not think a complete solution is available somewhere,so the question is

Which partial solutions exist today?

For example, somehow systematic ways to search into the man pages, instead of linking, would be a partial solution.

The man pages at manpages.ubuntu.com solve most of the problem, but they do not have anchors on the headings or sections.

That means, if I want to point to the section "Parameter Expansion" in man bash online, I have to use

See "Parameter Expansion" in man bash
[...and use your browser to search for "Parameter Expansion"]

This opens the bash man page at the top, as one long web page.

In the shell, I can say

See man bash | less "+/Parameter Expansion"

which jumps to the right place at startup.

It would be really helpful to have link anchors named like the headings they point to. Anchors named by some kind of index number would still help, but require a manual lookup on the actual web page to use it.

As it is not difficult on HTML level to add anchors to headings, I'm sure such man pages exist;
But is there a collection of the Ubuntu man pages with anchors online somewhere, or at least a good subset?

Example code

The header of section "Parameter Expansion" from
which kind-of-redirects to

       [ ... ]
       tildes in assignments to <b>PATH</b>, <b>MAILPATH</b>,  and  <b>CDPATH</b>,  and  the  shell
       assigns the expanded value.

   <b>Parameter</b> <b>Expansion</b>
       The `<b>$</b>' character introduces parameter expansion, command substitution,
       or arithmetic expansion.  The parameter name or symbol to  be  expanded
       [ ... ]

To be able to link directly to this section, we need something like:

       [ ... ]
       tildes in assignments to <b>PATH</b>, <b>MAILPATH</b>,  and  <b>CDPATH</b>,  and  the  shell
       assigns the expanded value.

   <a href="#ParameterExpansion"><b>Parameter</b> <b>Expansion</b></a>
       The `<b>$</b>' character introduces parameter expansion, command substitution,
       or arithmetic expansion.  The parameter name or symbol to  be  expanded
       [ ... ]

This adds one tag to the HTML code, and one attribute, the section name without spaces:

<b>Parameter</b> <b>Expansion</b>
<a href="#ParameterExpansion"><b>Parameter</b> <b>Expansion</b></a>

Now, we can link to the section like

or even

which uses a foot note and is is written like

Use of other reference documents

In many cases, there are alternative reference documents available, appart from the man page. These often have a good link structure that is used to link from a table of content to the sections, just what we need.
But this does not solve the general problem, as there is no common way to find whether/where such a document existst, and to make use of the link structure.

For the bash example used above, the Bash Reference Manual could be used as an individual solution looked up manually:

Bash Reference Manual section Shell-Parameter-Expansion
written as
[Bash Reference Manual section Shell-Parameter-Expansion](http://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion)

Proposed implementation

To propose actually implementing this idea at manpages.ubuntu.com,
I filed a closely related bug/enhancement request on the associated project "ubuntu-manpage-repository": launchpad #1355271: Use HTML a tags to allow external links to subsections of man pages


Yes, there is, it's http://man.cx/. It aims to have all man pages in one site, also in multiple languages. The anchors are unfortunately not named, but numbered: for example http://man.cx/printf#heading1 will take you to the first heading of the printf man page. Still I think it's better than without anchors ;)

PS. Add the site to your search engines, then you can simply type man printf in your address bar, and it will take you to the correct page, super awesome!

  • 1
    Great idea for the browser integration as search engine! – Philipp Wendler Aug 23 '14 at 17:47
  • Downvote without comment? – Gerhard Burger Sep 1 '14 at 18:58

On unix.stackexchange, there are ways described to use the offline manpages as hypertext too. The easiest way for me seems w3mman, which is part of the package w3m, so:

sudo apt-get install w3m

When you opened a man page, f.e. w3mman man, you can use TAB to navigate to the next link. (Other man-typical keyboard shortcuts work the same: scrolling, searching, quitting :-)

To turn off quit confirmation (like man behaves):

  • edit ~/.w3m/config

    • if not existing: cp /etc/w3m/config ~/.w3m/
  • set confirm_qq 0

To replace the normal man command:

  • edit ~/.bashrc

    • add alias man='w3mman'
  • source ~/.bashrc

Now man <some command> will use w3mman instead of the normal man :) I like it this way. Thanks for asking! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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