Ubuntu – Man pages offline for e-reader

manpage

Is there anywhere one can get a copy of Ubuntu's man pages in e-reader (preferably Kindle/mobi, epub can be handled)format?

Best Answer

This bash command will dump HTML files for every man page on the system. You'll need to install the groff package first, then cd to an empty directory and run:

for f in `ls -1 /usr/share/man/man*`; do n=`echo $f | sed s/[.].*[.]gz//`; man -Thtml $n > $n.html ; done

This will cycle through all of the files in the /usr/share/man directory, strip off the section number and the extension using sed, then call man to render the manpage to HTML (man -Thtml in turn calls groff, which is why you need it installed first), storing the result in an html file with the same name as the page. It will take a while to complete, and groff throws some warnings about line breaks, but when it finishes, you will have all of your man pages in HTML format.

Most e-readers can handle HTML files, but if yours doesn't, you can use calibre to convert the HTML files to mobi or epub or any other format you choose.