Use Preview to view man pages

Here’s a cool trick that converts man pages to postscript and opens the file in Preview. Add this to your .tcshrc file in your home directory:

alias preman 'man -t \!^ > /tmp/\!^.ps; open /tmp/\!^.ps'

Then to open man pages in Preview type:

preman NAMEHERE


3 Responses to “Use Preview to view man pages”  

  1. 1 Nick Klockenga

    Here, thanks for the idea Ronge

    I took your idea and extended it to a “better solution”. At least I think it is. Doing an alias will only work in one type of shell. So to get around that you could write a very simple bash script. I personally did this because I prefer bash shell.

    So for example I created scripted named “preman”. It contains this:

    #!/bin/bash

    man -t $* > /tmp/$*.ps
    open /tmp/$*.ps

    ######################

    This very simple script will do the exact same thing, only you can launch from any shell. You will want to put this script in your $PATH. I personally just put script in /bin dir. You will have to cp over as sudo though, and remember to change permission on script to execute (chmod a+x /bin/preman) for all users. If you need more instruction just comment here asking for more help.

  2. 2 Duane Bailey

    for those of you who use bash, just put:

    preman ()
    {
    man -t $* > /tmp/$*.ps
    open /tmp/$*.ps
    }

    inside of your .bashrc of .bash_profile file.

  1. 1 » Blog Archive » A Bash Program to view man pages in Preview.