Man Page to txt/pdf/doc/html

Linux offer various tools both inbuilt and external tools to convert the man pages to .txt / .pdf / .doc / .html from the command line. I have included some of the simple tools which helps to convert. If you are using CentOS/red-hat based system you can install the Ghostscript package to include many features.

 

  • # yum install ghostscript

 

Man page to Text (.txt)

 

Man command include the col binary to convert the man page to text file. You can use the following syntax.

 

  • # man man | col -b > man.txt

 

The above example convert the man pages of man to text and store it in the “man.txt” file name.

Sample url : http://gnutoolbox.com/samples/manpages/man.txt

 

Man page to html (.html)

 

Use the man2html tool to convert the converted ascii man output to html file. Syntax below

 

  • # man2html -title ‘manpage_title’ < ascii_output_file > html_file

 

Man page to PDF (.pdf)

 

You need the ps2pdf tool (inbuilt with ghostscript package) to convert the man page to .pdf. Following is the simple syntax which can convert the man page to pdf in a better resolution.

 

  • # man -t man | ps2pdf –  > man.pdf

 

Note : There is a space between pd2pdf and the .

 

Sample url: http://gnutoolbox.com/samples/manpages/man.pdf