Converting man pages to printable text and pdf files

To convert man pages of various Linux commands into a printable text file, use the following command:

$ man foo > man.txt

We can simply take a printout of the man.txt file, but the above step also copies unnecessary junk characters. In order to avoid this, the following command can be used.

$ man man | col -b > man.txt

man page to text or pdf file

Save the man page to text or pdf file

To convert man pages of various Linux commands into a pdf file, use the following command:

$ man -t man| ps2pdf ->  man.pdf

 In the above command, the output of  ‘man -t man’  is piped to the ps2pdf  program, which is then stored as man.pdf. This man.pdf file can be used like any other PDF file.

In fact, by this way we can prepare our own man page book  ;).

Quite handy, right ?