Bash Function to open man pages in new terminal window

When I’m stumbling around the command line, I usually need to keep various man pages open for reference. I always forget I can get a dedicated man window from the Help or Contextual menus. This bash function allows you to open a man page in a new window directly from the command line.

function man { if [ $# -eq 1 ] ; then open x-man-page://$1 ; elif [ $# -eq 2 ] ; then open x-man-page://$1/$2 ; fi }

Just put this function in your .bashrc file, and when you use the man command, the information opens in Terminal’s Man Page specific window setting style. If you don’t want to override the default ‘man’ command operation, you can change the function name to something else.

This function expands on OS X’s x-man-page url scheme. And of course, there are plenty of alternate ways to view man pages such as …

Source: Mac OSX Hints