Not quite the answer you were looking for, but it might be a better one.
mandb
is an implementation of man
that will format man pages in HTML. It was written by someone at Redhat and is I think now the standard on all .rpm
based systems, but available to install as a replacement for the old man on Debian, Ubuntu, et. al.
Using mandb, man -H whatever
will format the page in HTML and send it to $BROWSER
. There are a few man pages where this goes screwy (such as gcc
), but most of them are fine. It's also sometimes problematic with google-chrome
.
That's a great feature, but most of the time I can't be bothered -- I'd rather just glance through the page in a terminal. Thanks to lynx
, a text mode web browser, you can sort of get the best of both worlds. I don't want $BROWSER
to be lynx generally, so:
#!/bin/bash
BROWSER=lynx
man -H $@
And call this mnlx
or something. mandb
creates a tmp file to do this, so you could speed things up by caching the HTML versions and using those when available -- but that's a longer script...
The really nice thing about this is mandb
also adds an index with links to each section at the top, e.g.:
BASH BASH (p1 of 121)
NAME
SYNOPSIS
COPYRIGHT
DESCRIPTION
OPTIONS
ARGUMENTS
INVOCATION
DEFINITIONS
RESERVED WORDS
SHELL GRAMMAR
COMMENTS
QUOTING
PARAMETERS
EXPANSION
REDIRECTION
ALIASES
FUNCTIONS
[...]
The man page proper follows this. As manatwork indicates in the comments, italic and bold appear as red and (bold) blue in lynx; normal text is white, links are green, the current link is bold yellow.
man
implementation you use.man
from the mandb package has a--html
switch. When using it$BROWSER
is used for paging instead of$MANPAGER
or$PAGER
. – manatwork Dec 04 '13 at 11:15lynx
. It colors bold in red and italic in blue. (Not sure, but I think those are configurable.)BROWSER=lynx man -H man
: http://i.stack.imgur.com/zIRaw.png – manatwork Dec 04 '13 at 12:30--html
with mandb is-H
;) Lynx is a good idea. – goldilocks Dec 04 '13 at 13:02O)ptions
, scroll to the bottom to where it says "View the file lynx.cfg" -> "color-style configuration". Except you can't edit lynx.cfg in lynx, lol. The system wide is/etc/lynx.cfg
. @manatwork : You should put this up as an answer, it's great. – goldilocks Dec 04 '13 at 13:13less
? – jasonwryan Dec 04 '13 at 16:26w3m
as pager for a manual page? Are you talking about HTML manual pages? Also: Notless
has color support, but the terminal.less
can only send control sequences to the terminal to make that switch colors. Finally: Manual pages do not use colors; they use attributes like bold, underline, or italics. – U. Windl Jun 22 '22 at 07:28