Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert all Linux man pages to text / html or markdown

Tags:

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.

like image 373
KJS Avatar asked Nov 17 '12 19:11

KJS


1 Answers

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:

OUT_DIR=...  for i in `find -name '*.gz'`; do      dname=`dirname $i`     mkdir -p $OUT_DIR/$dname     zcat $i | groff -mandoc -Thtml > $OUT_DIR/$i.html done 
like image 109
ishi Avatar answered Sep 30 '22 23:09

ishi