Search:

eriksmartt.com/blog

 

Topics:

  • arduino (3)
  • art (2)
  • austin (39)
  • automotive (15)
  • blogging (25)
  • books (14)
  • business (5)
  • code (15)
  • design (10)
  • diy (3)
  • django (9)
  • experience (17)
  • family (2)
  • film (4)
  • food (1)
  • for:optaros (2)
  • gadgets (11)
  • games (11)
  • garden (3)
  • green (5)
  • hack (13)
  • hardware (11)
  • hci (9)
  • life (13)
  • lifehack (11)
  • links (71)
  • linux (8)
  • living (3)
  • make (3)
  • media (7)
  • mobile (98)
  • music (2)
  • news (17)
  • osx (29)
  • outdoors (4)
  • privacy (2)
  • product-management (1)
  • python (75)
  • quote (3)
  • security (10)
  • society (21)
  • software (38)
  • spam (2)
  • syndication (5)
  • technical (31)
  • technolust (5)
  • transportation (12)
  • travel (25)
  • ubuntu (7)
  • web (67)
  •  

    OS X: Opening man pages in Preview

    Filed under: code, lifehack, osx, technical — August 30, 2006

    Admittedly, this is perhaps more of an interesting trick rather then a needed feature; However, if you’ve ever wanted to print man pages or simply read them in a nice, anti-aliased document view instead of within the Terminal, here’s a tip you might like. The following bash script (and credit goes 100% to my friend Victor, who is sans-blog) will format and open man pages in Preview:

    
    #!/bin/bash
    
    cmd=$1
    if [ -z $cmd ]; then
        me=`basename $0`;
        echo "Usage: $me command_name";
        exit;
    fi
    
    man $1 > /dev/null 2>&1
    if [ $? -ne 0 ]; then
        echo "No man page for $cmd";
        exit;
    fi
    
    man -t $cmd|open -f -a /Applications/Preview.app
    

    On my box, I called the script ‘manpreview’ and dropped it in ~/bin/ for easy access. Once you `chmod u+x` it (and have ~/bin/ in your path), you’ll be able to do fun things like `manpreview tcpdump` for some extended reading.



    2 Responses to “OS X: Opening man pages in Preview”

    1. Avatar David Jacobs Says:

      Thanks.

    2. Avatar Jackson Says:

      This is GREAT! Thanks for the tip. I’m tagging this on Del.icio.us immediately!

    Leave a Reply


     

    A few books I'm reading now:

    A few books I'd recommend: