Bash Function to open man pages in new terminal window

Dec 30, '13 06:30:00AM

Contributed by: tmoswift

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 in preview, ManOpen, or Bwana.

Smallduck is the true author of this hint; I'm merely spreading the word.

Comments (14)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20131226153018801