Manpages for the kindle

hypertextman

I'd like to read unix manpages on my kindle. I know I can just redirect the man output to a file and give it a .txt extension. But is there a convenient way to convert them en masse to a format with proper cross-references?

Edit: An apology for my behavior in this question. I told pat that I would accept the comment if submitted as an answer, and then better answers came and I did not keep my promise (Sorry). I enthusiastically accepted Caleb's answer that produces html versions of the manpages; and then some time later when I actually tried transferring the files to the kindle, I discovered that the kindle would not display html files; and I switched acceptance without explanation (Sorry). The kindle appears to require .txt or .pdf (or one of the various real eBook formats). I hope I have explained myself.

Also, I didn't have a realistic understanding of how many, many manpages there are with a Debian Linux distribution, and so Caleb's comment about selecting a "Best Of" collection appears to be the best idea. But I don't really have the inclination to try to do this myself (which is a prerequisite for asking questions on StackExchange sites), so I'm not comfortable asking how to select the "Best Of", even though it really is necessary practically in order to do this.

Best Answer

To convert every man page to pdf I did man -k . > temp. I created a temp file and a script named file.sh:

#! /bin/bash
if [ $# -eq 1 ] ; then
    to_pdf=$(which ps2pdf)
    if [ -z "$to_pdf" ] ; then
    to_pdf=$(which pstopdf)
    fi
    name="$1"
    case "$to_pdf"  in
        *pstopdf) man -t "$name" | "$to_pdf" -i -o "$fname.pdf" ;;
        *ps2pdf)  man -t "$name" | "$to_pdf" - "$name.pdf" ;;
        *)        man -t "$name" > "$fname.ps"
    esac
    exit $?
fi
echo "Wrong number of parameters"
exit 1

I wrote a python file pythonfile.py

import os
f=open("temp","r")
for i in f:
    c="bash file.sh "+str(i)
    os.system(c)`

Then I did

python pythonfile.py 

This will create a pdf for every man page separately inside your working directory.

Related Question