I’ve found that I read a lot more man pages since I’ve automated the process of sending them to my kindle. My approach is to use a script to render a man page as a PDF and email it to my kindle.com email address.

Mail Setup

You’ll need to be able to send email from the command line using the mail utility. The approach I took was to install Postfix and configure it to send via SMTP though AWS/SES. Amazon’s SES / Postfix integration instructions mostly worked except that I had to use port 587 instead of the port 25 used in their examples.

Converting a Man Page to a PDF

Rendering a man page as a PDF is easy:

man -Tpdf awk > awk.pdf

However, the above renders to an 8.5x11” paper size which results in smaller fonts on the Kindle. A better option would be to use something more narrow like A5 paper (5.83x8.27”) but man does not give us that option.

Fortunately, however, groff does. First, use man -w to get the path to the compressed troff, use xargs to uncompress it using zcat, and pipe that to groff passing the options to render it for A5:

man -w awk | xargs zcat | groff -mandoc -Tpdf -dpaper=a5 -P-pa5 > awk.pdf

And there you have it! A PDF of the awk man page which renders reasonably well on the Kindle.

The Script

I suggest you script this so you use it more. Here’s an example script which finds the man page, renders it as an A5 PDF, and sends it to an email address (presumably that of your kindle) with a reasonable filename / title:

#!/bin/bash

FILE=`man -w $@` || exit
BASENAME=`basename $FILE`
TITLE=${BASENAME%.gz}
DIR=$(mktemp -d)

zcat $FILE | groff -mandoc -Tpdf -dpaper=a5 -P-pa5 > $DIR/$TITLE.pdf
echo body | mail -s "subject" -r from@example.com -a $DIR/$TITLE.pdf to@kindle.com

rm -rf $DIR