Converting "man" Pages into PDF Documents |
Desktop Training - Linux Newbie |
Converting "man" Pages into PDF Documents How many times have you had to consult a man page, and wished that there were an easy way to print out a hard-copy for later reference? Well, there is a way, and you've had it at your fingertips the whole time. It only takes one simple command to convert a man page into a PDF file. Everything you need should already be installed on your Linux system. Let's say that you want to print out the man page for the "groff" utility. Just enter the command: man -t groff | ps2pdf - > groff.pdf (Note: There is a blank space between "ps2pdf" and the dash, and also between the dash and the "greater than" sign.) You can just user your normal user account for this; there's no need for any root privileges. Now, you can use your favorite PDF file viewer--Evince, Adobe Reader, etc.--to view and print out the file. (You may have to install one of these programs from your distro's repository.)
Theory We're actually using three command-line utilities to do this. man -- This is the default viewer for man pages -t -- The "-t" switch calls in the "groff" utility to convert the man output to Postscript format. ps2pdf -- Finally, we'll feed the Postscript output from "groff" into this utility. This will create our PDF file, and the "> somefile.pdf" part will save the output to our new file. For more info, on the ps2pdf utility, consult the Ghostscript website.
|