Fork me on GitHub


View man files as PDF

January 18, 2011 | Computers

Sometimes viewing man pages on the command line is less than convenient. Ok, its always inconvenient. But there’s a better way: convert the man page to pdf and view it with Preview.

Add this to a file, I named mine manv, put it in a safe place (I keep a /bin folder in my home directory) and make it executable with chmod a+x filename.

#! /bin/bash
if [ "$#" = "1" ]; then
man -t ${1} > /tmp/${1}.ps
pstopdf /tmp/${1}.ps /tmp/${1}.pdf
open -a /tmp/${1}.pdf
sleep 10
rm /tmp/${1}.ps /tmp/${1}.pdf

Now invoke the man page with your new script name instead of with man and read it in Preview. Enjoy!

One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.


  1. Around the web |

    […] View man files as PDF – handy! […]

    January 23, 2011 | 5:12 pm

Comments are closed