man2html(1)
๐ man2html โ the manual page glow-up machine ๐
okay bestie, come sit with me, because this one is a general commands manual classic and it's literally about turning boring old man pages into gorgeous html. no cap. ๐ฆ
โจ NAME โจ
man2html โ format a manual page in html ๐
๐ธ SYNOPSIS ๐ธ
man2html [options] [file]
๐ DESCRIPTION ๐
So here's the tea, bestie: man2html takes a manual page โ the kind you find in file, or from stdin if you didn't hand it a file argument or you passed the argument "-" โ and converts it from man-style nroff into html. Then it prints the result on stdout. It does support tbl but it does not know about eqn. The exit status is 0. And if something goes wrong? It prints an error page on stdout. iconic behaviour honestly. โจ
You can totally use this as a stand-alone utility, but its main character energy is as an auxiliary โ it exists so users can browse their man pages using an html browser like lynx(1), xmosaic(1) or netscape(1). obsessed. ๐
The main part of man2html is the troff-to-html engine written by Richard Verhoeven (rcb5@win.tue.nl). It adds hyperlinks for the following constructs:
foo(3x)โ"http://localhost/cgi-bin/man/man2html?3x+foo"method://stringโ"method://string"www.host.nameโ"http://www.host.name"ftp.host.nameโ"ftp://ftp.host.name"name@hostโ"mailto:name@host"<string.h>โ"file:/usr/include/string.h"
(The first of these can be tuned by options โ see below, bestie, keep reading.) And ngl, no lookup is done โ the links generated need not exist, they're just vibes. Also an index with internal hyperlinks to the various sections is generated, so it's easier to find your way around in large man pages like bash(1). slay. ๐ซถ
๐ OPTIONS ๐
When reading from stdin, it's not always clear how to do .so expansion. The -D option allows a script to define the working directory. ๐
-Dpathname โ Strip the last two parts from the pathname, and do achdir(dir)before starting the conversion.
The -E option allows the easy generation of error messages from a cgi script. ๐
-Estring โ Output an error page containing the given error message.
The general form of a hyperlink generated for a man page reference is:
<method:cgipath><man2htmlpath><separator><manpage>
with a default as shown above. The parts of this hyperlink are set using the various options. ๐
-hโ Setmethod:cgipathtohttp://localhost.-Hhost[.domain][:port]โ Setmethod:cgipathtohttp://host.domain:port.-lโ Setmethod:cgipathtolynxcgi:/usr/lib.-Ldir โ Setmethod:cgipathtolynxcgi:dir.-Mman2htmlpath โ Set theman2htmlpathto use. The default is/cgi-bin/man/man2html.-pโ Setseparatorto'/'.-qโ Setseparatorto'?'. This is the default.-rโ Use relative html paths, instead of cgi-bin paths.
On a machine without a running httpd, one can use lynx to browse the man pages, using the lynxcgi method. When some http daemon is running, lynx, or any other browser, can be used to browse the man pages, using the http method. The option -l (for lynxcgi) selects the former behaviour. With it, the default cgipath is /usr/lib. ๐
In general, a cgi script can be called by:
<path_to_script>/<more_path>?<query>
and the environment variables PATH_INFO and QUERY_STRING will be set to <more_path> and <query>, respectively. Since lynxcgi does not handle the PATH_INFO part, we generate hyperlinks with '?' as a separator by default. The option -p (for path) selects '/' as a separator, while the option -q (for query) selects '?' as a separator. ๐
The option -H host will specify the host to use (instead of localhost). A cgi script could use:
man2html -H $SERVER_NAME
if the variable SERVER_NAME is set. This would allow your machine to act as a server and export man pages. main character server energy fr fr. ๐
๐ BUGS ๐
There are many heuristics. The output will not always be perfect. ๐ญ The lynxcgi method will not work if lynx was compiled without selecting support for it. There may be problems with security. (bestie, be careful, I'm just the messenger ๐)
๐ง AUTHOR ๐ง
Richard Verhoeven was the original author of man2html. Michael Hamilton and Andries Brouwer subsequently improved on it. Federico Lucifredi <flucifredi@acm.org> is the current maintainer. ๐ซถ
โญ SEE ALSO โญ
and that's the whole page, bestie!! this beauty is from the General Commands Manual, dated 1 January 1998 โ go forth and html-ify your man pages, you absolute icon ๐โจ๐๐ฆ๐ธ
๐ฆ where this page comes from
- debian bookworm: man2html-base 1.6g-14 ยท GPL-2.0-or-later
- debian trixie: man2html-base 1.6g-16 ยท GPL-2.0-or-later
- ubuntu jammy: man2html-base 1.6g-14 ยท GPL-2.0-or-later
- ubuntu noble: man2html-base 1.6g-16 ยท GPL-2.0-or-later
- ubuntu questing: man2html-base 1.6g-16
- ubuntu resolute: man2html-base 1.6g-16build1 ยท GPL-2.0-or-later
- ubuntu stonking: man2html-base 1.6g-16build1 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms