Planet London Python

August 22, 2017

Jonathan Hartley

Postscript formatted man pages

man and its troff formatting can be asked to produce postscript output. Define a Bash function, e.g. in your .bashrc:

function psman () {
    SLUG=$(echo $@ | tr ' ' '-')
    man -t "$@" | ps2pdf - "$FNAME"
    nohup evince "$FNAME" >/dev/null 2>/dev/null

(I tried to do this without tempfiles, using process substitution, but failed. Anyone got better Bash-fu?)

The man -t is the crucial part. It tells man to produce output in postscript format, which ps2pdf can read, and evince displays the PDF. We disconnect the evince process using nohup, so that it lives on even if we kill the terminal.

Then, from the command line:

$ psman tr



by tartley at August 22, 2017 07:34 PM