Converting Linux Documentation to MOBI for the Amazon Kindle

Linux Manual Pages

VIM Help Documentation

Gentoo Documentation

Linux Manual Pages

Groff to HTML to MOBI

Your Linux system likely has the Man package installed, it's installed on almost all basic Linux systems to read the Linux Manual Pages, and packages a command line tool called "man2html".

I've created a custom script called to convert all of your system installed man pages to HTML into the /tmp folder.  From here, you can use Amazon's KindleGen to convert the resulting HTML files to MOBI.  And then, copy them to your Kindle device, preferably to a sub-folder of the documents folder.

The process is quite simple, and you can try performing the process manually on individual files:

$ cp /usr/share/man/man1/bash.1.bz2 ./

(The file suffix may change depending on your distribution's choice of compression.)

$ bzip2 -d bash.1.bz2

(Or gunzip -d bash.1.gz)

$ man2html bash.1> bash.html

$ kindlegen -c2 bash.html

You don't need the "-c2", but for larger files it might be a good thing.  It can reduce the file size by half for the Bash Manual Page.  A lot of manual pages are quite small, and kindlegen will automatically disable the compression if the file is too small.  I haven't done benchmarking, but common sense tells me using compression on with a small CPU might be counter intuitive, causing the file to open and render more slower then a non-compressed file.  kindlegen without any options, prints it's help page.

Pray for an open sourced kindlegen, as the <table> <border=0> work around can then be worked into the code somewhere along with other bug fixes.  For now, the AmazonKindlePublishingGuidelines.pdf advises authors of HTML pages of the limitations of this HTML tag and how to format their pages for the Amazon Kindle Devices.

VIM Help Documentation

Text to HTML to MOBI

The /usr/share/vim/vim73/doc/ script can convert all VIM Help text files to HTML.  From there, one can use kindlegen to convert all HTML files to MOBI.

$ mkdir /tmp/html && cd /tmp/html

$ /usr/share/vim/vim73/doc/ /usr/share/vim/vim73/doc/tags /usr/share/vim/vimfiles/doc/*.txt

$ kindlegen *.html

And copy the *.mobi files to your device.

$ mkdir /media/Kindle/documents/vim && cp *.mobi /media/Kindle/documents/vim

Gentoo Documentation

XML to HTML to MOBI (using the lazy Seamonkey method)

All Gentoo documentation is in XML format and available by CVS (gentoo/xml co 351MB).  This includes the installation, developer handbook as well as a multitude of other documentation, including their foriegn language equivalents.

The only method I know so far, is to select the Print View option within the page of the Seamonkey (Mozilla or Firefox) Browser, to get all pages within one page.  Save the file as HTML (File > Save Page), which will save the page along with all graphics (and saving all the graphics within a subfolder).  You can then use kindlegen on the individual HTML page saved.

If you know of any command line methods of converting the multiple page Gentoo XML documentation downloaded via CVS to one page of HTML, let me know!  I'm sure, with some time, one could make sure all HTML files are linked properly so kindlegen can link all pages.  For now, one page HTML is just easier.  An EPUB version of the Gentoo documentation would be great, as conversion from EPUB to MOBI using kindlegen provides some of the best results.