Update Information:Updated on 5 September 2021
When you read the man man, you find another way. See the last section.
So I did a thing, and I posted it to Reddit:
Most applications in Linux come with a man page—essentially, an online manual. You can invoke this for any installed app with
<application> is the name of the app in question.
I will say that the quality (and size) of these vary by package; you may or may not find what you are looking for, either because it is not there, or because it is buried in the middle of 100 different screens.
I do tend to learn better when I can manipulate information in some way, either by rewriting it or by making notes or highlighting things. This, of course, requires that the information ends up on paper at some point. Hence, “man booklets”.
It’s easy enough to make booklets on Linux using an application called boomaga. To see if it’s already installed on your system, run
which will tell you which version is installed. Alternately, you could run
which will tell you where it’s installed.
If it’s not installed, just run
sudo apt install boomaga
and enter your root password when you’re asked for it.
Getting Man Pages into Text
Let’s use git as an example. To get the git man page into text is fairly simple. All we need to do is run
man git > git.txt
You now have a file called
git.txt on your computer. Open it in your default text editor, and then go to
File » Print to bring up your print dialogue. You should now see Boomaga listed as another printer:
Go ahead and select Boomaga and then click “Print”. Boomaga will then bring up its own print dialogue box:
Note that “Booklet” is already selected here. It remembers your last selection.
If all you want to do is print your booklet, select the printer you want to use in the “Printer” drop-down. A couple of points to keep in mind:
- If your printer does not have a duplexing unit (i.e., it does not print automatically on both sides), you’ll need to put the printed sheets back in your printer to print the second side. (Whether they go blank side up or blank side down is something you can probably find in your printer manual. Or you can experiment.)
- If your printer does have a duplexing unit, chances are that you will want to flip them on the short side. If not, half of your pages will be printed upside down.
Click “Print and Close” and enjoy your booklet.
If you want to save your booklet as a pdf to send to someone and let them print it out, first go to “File” in the Boomaga print dialogue and select “Export to pdf”.
A Slightly More Pretty Way…
I’ve got to admit, I’m just fine with a plain text file. But some people may prefer something with a bit more formatting. As someone suggested on Reddit, you can use the
-t option in
man to convert the man page to a nicely formatted PostScript document.
We’ll use git again. Just enter
man -t git > git.ps
Notice that we’re using the
.ps file extension, rather than
In Ubuntu, you can open that PostScript file directly in Document Viewer and proceed as above. If you’re on a different Linux distribution, you’ll have to use whatever app your distro relies upon to view and print PostScript files.
You can use a long-reach stapler, but I always used to get uneven results from them. A saddle stapler, where you fold the paper first, and then staple directly on the fold, is the way to go. I own this one, which I purchased directly from Bostitch.
An even more stylish way
When you read the man man document, you’ll find this gem starting on line 123:
Manual pages are normally stored in nroff(1) format under a directory
such as /usr/share/man. In some installations, there may also be pre‐
formatted cat pages to improve performance. See manpath(5) for details
of where these files are stored.
A quick trip to
/usr/share/man revealed a bunch of localization folders, and eight folders named man1, man2, man3, etc. Opening man1, I found a file called
man.1.gz. I copied this to a temporary working directory in my home folder and extracted the only file it contained, which is named “man.1”. This is the troff document that is used to generate the man page.
Caution!What follows is a bit of a kludge. I really should learn how to use troff. But this version works.
I ran that file through pandoc using the command
pandoc -V geometry:paperheight=8.5in,paperwidth=5.5in,left=1cm,right=1cm,top=1cm,bottom=2cm --pdf-engine=xelatex man.1 -o man.pdf
A big issue that I have with the booklets as I originally produced them is that we are shrinking a letter size sheet (8.5″ x 11″) onto a letter half sheet (5.5″ x 8.5″). These are not proportional, unlike metric paper, so not only are you reducing the size, you also end up with a lot of unused white space. Once you run the resulting pdf through Boomaga, this kludge gets us a nicely sized book with full-size lettering and no wasted white space. In fact, because we are not wasting space, the new man booklet is only 14 pages of easy-to-read type whereas the old one is 16 pages of small type.
You’ll also notice in that command the option
--pdf-engine=xelatex. That is in there because there is a unicode character in the troff file that Pandoc couldn’t handle, and it threw up an error stating that, but it also told me what I needed to do to fix it. (I did have to install xelatex, however.)
That’s all for now. I’m off to read the troff man pages.
Downloads:I’ve created an online git repository for these. You can find it at https://git.kjodle.net/kjodle/man-pages. Enjoy!