Ubuntu – Downloading Entirety of Lubuntu/Ubuntu Man-pages

15.10documentationlubuntumanpagepdf

I know about this page which is almost exactly what I want. Unfortunately, it is not current.

What I would like to do is to have the entirety of the Ubuntu man-pages in a nice, easy to read, PDF format. I'll accept other formats but I'd prefer an indexed PDF file for simplicity and portability.

I am also aware of HTTrack which can pull down the pages in HTML format. There are a few reasons that I wish to avoid this – the primary reason being that it's not really a nice thing to do to their bandwidth and servers.

I've searched the Ubuntu site, used an external search engine, and have searched this site. I did find one answer that led me back to HTTrack which is a potential solution but not the ideal solution and, as mentioned, isn't very nice to their servers or bandwidth.

Even more special would be being able to get this specifically for Lubuntu because there are a few differences in software and I'm an avid Lubuntu user but, if need be, I can make due with just the Ubuntu man-pages.

The reason that I want this is because, well, I'd like to read it – in its entirety. More like a book than like a file that is called when needed. I want to be able to read it while I only have access to my phone, tablet, or other compute device and in an easier to read format than the man-pages typically use.


EDIT:

Specifically for Ubuntu (or Lubuntu) version 15.10, as noted in the tags and title. Also, yes – all the man-pages (even redundant and short ones). I'm aware that this is a lot of information which is one of the reasons that I'm trying to avoid using HTTrack.

Best Answer

Even more special would be being able to get this specifically for Lubuntu because there are a few differences in software and I'm an avid Lubuntu user but, if need be, I can make due with just the Ubuntu man-pages.

There are no differences in manpages between Lubuntu and Ubuntu. One of the points of becoming a recognized flavour is using the same repositories as Ubuntu, so the software is identical, it's only the starting points that differ.

Also, http://manpages.ubuntu.com suffers from a bug where identically named manpages from different packages aren't distinguished - the manpages of the last package read show up.

Instead of hammering the manpages site, hammer the repositories.

Get a list of manpages, for, say, the binary-amd64 architecture (should be identical to the others):

mkdir temp
cd temp
curl http://archive.ubuntu.com/ubuntu/dists/wily/Contents-amd64.gz | 
  gunzip | 
  grep 'share/man' |
  sed 's/.* //;s/,/\n/g' | 
  awk -F/ '{print $NF}' | 
  sort -u > packages.txt
while IFS= read -r package
do
    apt-get download "$package"
    dpkg-deb --fsys-tarfile "$package"*.deb | tar x ./usr/share/man
    mkdir "$package"-manpages
    find ./usr/share/man/man* -type f -exec mv -t "$package"-manpages {} +
    rm "$package"*.deb
    for page in "$package"-manpages/*
    do
        man -t "$page" | ps2pdf - > "$page".pdf
    done
done < packages.txt

If course, this is going to consume an insane amount of bandwidth - the repository servers are used to it, the question is: is your network upto the task?