Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
2  
    
@pat That's perfect! Make it an answer and I'll accept it. –  luser droog Dec 29 '11 at 8:09
    
Spoke too soon :( Thanks all the same. –  luser droog Dec 30 '11 at 7:55

3 Answers 3

up vote 2 down vote accepted

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.

share|improve this answer

To dump all the sections of all the man pages on your system to html you could try something like this from a blank directory:

IFS=\.
find /usr/share/man/man* -type f -exec basename {} .gz \; |
    while read page section; do
        man -Thtml $section $page > $page.$section.html
    done
share|improve this answer
    
Gee, it sure takes a while, don't it? :) –  luser droog Dec 30 '11 at 7:51
1  
@luserdroog: Yes indeed it does. You're the one that asked to convert every unix man page on your system en masse! If what you really want is a "best of" collection to browse in your spare time, a different approach is probably in order. –  Caleb Jan 2 '12 at 13:45

As per your request, made it an answer.

Check this http://askubuntu.com/questions/21903/man-pages-offline-for-e-reader

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.