Converting Linux man files to html files


 

 

 

 

 

Introduction

This page describes a way to convert Linux man files to html files. It is based on Red Hat Linux 9, but is probably valid for other Linux versions.

Nothing here is rocket science, but it might be useful to somebody somewhere.

 

How to do it

In Red Hat Linux 9, the man files are stored in /usr/share/man/ , in a series of directories named man1 through man9.

Each man file is named something like "xxxxxxxx.1.gz" or "yyyyyy.8.gz", where the number is the same as the directory number. The files are compressed.

Don`t mess with the files in these directories, copy the required man file somewhere else -

 

    mkdir /html

    cp /usr/share/man/man8/yyyyyy.8.gz /html/   

unzip it

 

    gunzip /html/yyyyyy.8.gz    

Now it gets a bit more interesting - the conversion process can be done by the groff utility - groff is a document formatting system that comes with Red Hat Linux 9.

In this case, by specifying the groff "html" device, and the "man" macros, we can get groff to format the document in html format.

We can redirect the output of groff into a new html file.

 

    cd /html/

    groff -T html -man yyyyyy.8 > yyyyyy.htm    

And that should be it.

 


© 2003 Ron Turner


Return to the Index page