KJS KJS - 1 year ago 142
Linux Question

Convert all Linux man pages to text / html or markdown

Is there a way to convert all Linux man pages to either plain text, html or markdown?

I need to do this for every man file I have installed on my system.

Answer Source

Yes... To convert one of them, say, man of man:

zcat /usr/share/man/man1/man.1.gz  | groff -mandoc -Thtml

If you want 'all of installed on your PC', you just iterate through them. For different output (text, for example), use different 'device' (the -T argument).

Just in case... if the 'iteration' was the real problem, you can use:


for i in `find -name '*.gz'`; do 
    dname=`dirname $i`
    mkdir -p $OUT_DIR/$dname
    zcat $i | groff -mandoc -Thtml > $OUT_DIR/$i.html
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download