Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Use Preview to view formatted man pages UNIX
Tiger only hintIf you don't like having to scroll through man pages with the arrow keys on iTerm, or if you just want them to look better, you can get your Mac to open them in Preview using an undocumented feature of the open command that's been mentioned on this site before. This bit of code...
man -t whatever | open -f -a /Applications/Preview.app
...will open the manpage for whatever in a nicely-formatted Preview window. If you use tcsh as your shell, you can create a pman alias that will do the same thing by adding this line to your user's .tcshrc file, found in your home directory:
alias pman "man -t !:* | open -f -a /Applications/Preview.app
[robg adds: This hint is somewhat of a roll-up of a number of other existing hints, but I felt it was worth publishing on its own, due to the simplicity of the solution. Although the command will work in 10.3, Preview won't render the postscript output; you'll just see the raw code. And thanks to fds for the first comment, pointing out the error of my ways in rying to make a bash alias out of this command!]
    •    
  • Currently 2.33 / 5
  You rated: 1 / 5 (6 votes cast)
 
[32,473 views]  

10.4: Use Preview to view formatted man pages | 41 comments | Create New Account
Click here to return to the '10.4: Use Preview to view formatted man pages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Use Preview to view formatted man pages
Authored by: fds on Dec 30, '05 07:41:37AM
That's not a quoting issue, in bash, aliases cannot contain parameters.
Functions can, however:
pman() { man -t "$@" | open -f -a Preview; }

[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: kreatix on Dec 30, '05 03:17:29PM

And how would you use this to make an alias in .profile?



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: theilgaard on Jan 03, '06 04:38:52AM
In 10.4 I saved the above function in my .bash_profile file located at the root of my home folder.

[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: mshmgi on Dec 30, '05 08:04:49AM

You could also just create a shell script and put it somewhere in your PATH.

Name it "pman", and "chmod 755" it...


#!/bin/bash
mpg=$1;
if [ ! $mpg ];then
	echo "Enter man page to read: ";
	read mpg;
fi
if [ ! $mpg ];then
	exit;
fi
man -t $mpg | open -f -a /Applications/Preview.app;
exit;



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: wgscott on Dec 30, '05 08:31:25AM
Just yesterday I came across a safari plugin that permits you to view man pages in safari: This hint was still very helpful to me because it is the first time I saw how to pipe into Preview (I was missing the critical -f).

[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: simbalala on Dec 30, '05 10:56:14AM

I agree, Bwana is great, so is Man.

The PDF tip is good but unless you want to print the pages the web browser display is much more convenient. And if you start printing Man pages you'll need a thick, thick binder to keep all them in.



[ Reply to This | # ]
Should have said ManOpen
Authored by: simbalala on Dec 30, '05 11:08:41AM

err...

I should have said ManOpen as other posters have mentioned. It's the easiest thing in the world. Just type man:ls (for example) into your browser's address bar and you're done. It's just too easy to remember and use.



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: MrWizzle on Dec 30, '05 09:30:05AM

Please excuse my ignorance, but what's the PATH? I'm new to all this Unix stuff. Only had my Mac for a couple of months... damn Windows rotted my mind.



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: xSmurf on Dec 30, '05 10:21:40AM
The PATH is the location where all the, terminal, programs are store. If you can type 'gre' and hitting tab autocompletes to 'grep' it's because 'grep' is in your path. The PATH is set in your ~/.bash_profile (if running bash) and will look something like export PATH=$PATH:/usr/local/bin:~/bin. You can see in my example that I add /usr/local/bin and ~/bin to the existing $PATH variable (which probably already holds paths like /bin and /sbin). Hope this helps.

---
SnitchCTL : http://snitchctl.smurfturf.net/

PM G4 DP 800 / 1.25gb / 120Gb+80Gb / CD/DVD±RW/RAM/DL
- The only APP Smurf

[ Reply to This | # ]

What is the PATH?
Authored by: hayne on Dec 30, '05 10:37:33AM
See this Unix FAQ

[ Reply to This | # ]
What is the PATH?
Authored by: MrWizzle on Dec 30, '05 10:57:15AM

xSmurf: Excellent example, makes it nice 'n' clear.
Hayne: That will be extremely useful in the future!

Thank you both! One of the reasons why I love the Mac is the sense of community around it.



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: klktrk on Dec 30, '05 08:50:41AM

I don't know what kind of machines you are using, but converting the man page for 'man' took about 50 seconds (and also generated the below entries in the console). The formatted pages look gorgeous, so this seems more like a good hint for how to print out a man page rather than using for ad hoc reference.

For quick references to man pages, I recommend a nice Cocoa util called ManOpen (you can find it on macupdate.com).

In the terminal I just defined the following alias:
alias man='/usr/local/bin/openman'

Now, whenever I type 'man foo', I get a window in ManOpen with the contents of the command's man page beautifully laid out, while I'm still able to work in the Terminal window. And it takes all of four seconds. Much better.

Oh, the log entries from the hint command. Have fun scrolling!

2005-12-30 11:43:13.941 Preview[7188] PostScript conversion message: /LiGothicMed
2005-12-30 11:43:14.802 Preview[7188] PostScript conversion message: /AppleGothic
2005-12-30 11:43:14.961 Preview[7188] PostScript conversion message: /AquaKana-Bold
2005-12-30 11:43:15.028 Preview[7188] PostScript conversion message: /AquaKana
2005-12-30 11:43:15.108 Preview[7188] PostScript conversion message: /Courier
2005-12-30 11:43:15.151 Preview[7188] PostScript conversion message: /Courier-Bold
2005-12-30 11:43:15.194 Preview[7188] PostScript conversion message: /GeezaPro-Bold
2005-12-30 11:43:15.205 Preview[7188] PostScript conversion message: /GeezaPro
2005-12-30 11:43:15.236 Preview[7188] PostScript conversion message: /Geneva
2005-12-30 11:43:16.100 Preview[7188] PostScript conversion message: /SIL-Hei-Med-Jian
2005-12-30 11:43:16.173 Preview[7188] PostScript conversion message: /HelveticaLTMM
2005-12-30 11:43:16.248 Preview[7188] PostScript conversion message: /Helvetica
2005-12-30 11:43:16.290 Preview[7188] PostScript conversion message: /Helvetica-Bold
2005-12-30 11:43:16.467 Preview[7188] PostScript conversion message: /LucidaGrande
2005-12-30 11:43:16.573 Preview[7188] PostScript conversion message: /LucidaGrande-Bold
2005-12-30 11:43:16.626 Preview[7188] PostScript conversion message: /Monaco
2005-12-30 11:43:17.150 Preview[7188] PostScript conversion message: /Osaka
2005-12-30 11:43:17.415 Preview[7188] PostScript conversion message: /Osaka-Mono
2005-12-30 11:43:17.521 Preview[7188] PostScript conversion message: /Symbol
2005-12-30 11:43:17.574 Preview[7188] PostScript conversion message: /Times-Roman
2005-12-30 11:43:17.598 Preview[7188] PostScript conversion message: /Times-Bold
2005-12-30 11:43:17.634 Preview[7188] PostScript conversion message: /Times-Italic
2005-12-30 11:43:17.705 Preview[7188] PostScript conversion message: /Times-BoldItalic
2005-12-30 11:43:17.736 Preview[7188] PostScript conversion message: /TimesLTMM
2005-12-30 11:43:17.768 Preview[7188] PostScript conversion message: /ZapfDingbatsITC
2005-12-30 11:43:21.121 Preview[7188] PostScript conversion message: /ZapfDingbats
2005-12-30 11:43:21.818 Preview[7188] PostScript conversion message: /HiraMaruPro-W4
2005-12-30 11:43:22.693 Preview[7188] PostScript conversion message: /HiraMinPro-W3
2005-12-30 11:43:23.458 Preview[7188] PostScript conversion message: /HiraMinPro-W6
2005-12-30 11:43:24.170 Preview[7188] PostScript conversion message: /HiraKakuPro-W3
2005-12-30 11:43:24.851 Preview[7188] PostScript conversion message: /HiraKakuPro-W6
2005-12-30 11:43:25.267 Preview[7188] PostScript conversion message: /HiraKakuStd-W8
2005-12-30 11:43:25.857 Preview[7188] PostScript conversion message: /LiHeiPro
2005-12-30 11:43:27.434 Preview[7188] PostScript conversion message: /STXihei
2005-12-30 11:43:28.637 Preview[7188] PostScript conversion message: /STHeiti
2005-12-30 11:43:29.608 Preview[7188] PostScript conversion message: /JCkg
2005-12-30 11:43:29.837 Preview[7188] PostScript conversion message: /JCHEadA
2005-12-30 11:43:30.971 Preview[7188] PostScript conversion message: /JCsmPC
2005-12-30 11:43:31.462 Preview[7188] PostScript conversion message: /JCfg
2005-12-30 11:43:31.626 Preview[7188] PostScript conversion message: /AlBayan
2005-12-30 11:43:31.642 Preview[7188] PostScript conversion message: /AlBayan-Bold
2005-12-30 11:43:31.697 Preview[7188] PostScript conversion message: /AmericanTypewriter-CondensedBold
2005-12-30 11:43:31.701 Preview[7188] PostScript conversion message: /AmericanTypewriter-CondensedLight
2005-12-30 11:43:31.712 Preview[7188] PostScript conversion message: /AmericanTypewriter
2005-12-30 11:43:31.733 Preview[7188] PostScript conversion message: /AmericanTypewriter-Bold
2005-12-30 11:43:31.754 Preview[7188] PostScript conversion message: /AmericanTypewriter-Condensed
2005-12-30 11:43:31.771 Preview[7188] PostScript conversion message: /AmericanTypewriter-Light
2005-12-30 11:43:31.839 Preview[7188] PostScript conversion message: /AndaleMono
2005-12-30 11:43:31.934 Preview[7188] PostScript conversion message: /Apple-Chancery
2005-12-30 11:43:32.939 Preview[7188] PostScript conversion message: /LiSungLight
2005-12-30 11:43:33.105 Preview[7188] PostScript conversion message: /AppleSymbols
2005-12-30 11:43:34.285 Preview[7188] PostScript conversion message: /AppleMyungjo
2005-12-30 11:43:34.460 Preview[7188] PostScript conversion message: /ArialMT
2005-12-30 11:43:34.464 Preview[7188] PostScript conversion message: /Arial-BoldMT
2005-12-30 11:43:34.468 Preview[7188] PostScript conversion message: /Arial-ItalicMT
2005-12-30 11:43:34.477 Preview[7188] PostScript conversion message: /Arial-BoldItalicMT
2005-12-30 11:43:34.559 Preview[7188] PostScript conversion message: /Arial-Black
2005-12-30 11:43:34.607 Preview[7188] PostScript conversion message: /ArialNarrow
2005-12-30 11:43:34.611 Preview[7188] PostScript conversion message: /ArialNarrow-Bold
2005-12-30 11:43:34.638 Preview[7188] PostScript conversion message: /ArialNarrow-Italic
2005-12-30 11:43:34.641 Preview[7188] PostScript conversion message: /ArialNarrow-BoldItalic
2005-12-30 11:43:34.923 Preview[7188] PostScript conversion message: /ArialRoundedMTBold
2005-12-30 11:43:34.947 Preview[7188] PostScript conversion message: /ArialHebrew
2005-12-30 11:43:34.954 Preview[7188] PostScript conversion message: /ArialHebrew-Bold
2005-12-30 11:43:35.018 Preview[7188] PostScript conversion message: /Ayuthaya
2005-12-30 11:43:35.031 Preview[7188] PostScript conversion message: /Baghdad
2005-12-30 11:43:35.058 Preview[7188] PostScript conversion message: /Baskerville-BoldItalic
2005-12-30 11:43:35.062 Preview[7188] PostScript conversion message: /Baskerville
2005-12-30 11:43:35.071 Preview[7188] PostScript conversion message: /Baskerville-Italic
2005-12-30 11:43:35.076 Preview[7188] PostScript conversion message: /Baskerville-SemiBoldItalic
2005-12-30 11:43:35.079 Preview[7188] PostScript conversion message: /Baskerville-SemiBold
2005-12-30 11:43:35.083 Preview[7188] PostScript conversion message: /Baskerville-Bold
2005-12-30 11:43:36.455 Preview[7188] PostScript conversion message: /DFKaiShu-SB-Estd-BF
2005-12-30 11:43:36.619 Preview[7188] PostScript conversion message: /BigCaslon-Medium
2005-12-30 11:43:36.790 Preview[7188] PostScript conversion message: /BrushScriptMT
2005-12-30 11:43:36.809 Preview[7188] PostScript conversion message: /Chalkboard
2005-12-30 11:43:36.849 Preview[7188] PostScript conversion message: /Chalkboard-Bold
2005-12-30 11:43:36.938 Preview[7188] PostScript conversion message: /CharcoalCY
2005-12-30 11:43:36.958 Preview[7188] PostScript conversion message: /Cochin
2005-12-30 11:43:36.992 Preview[7188] PostScript conversion message: /Cochin-Italic
2005-12-30 11:43:37.003 Preview[7188] PostScript conversion message: /Cochin-BoldItalic
2005-12-30 11:43:37.009 Preview[7188] PostScript conversion message: /Cochin-Bold
2005-12-30 11:43:37.093 Preview[7188] PostScript conversion message: /ComicSansMS
2005-12-30 11:43:37.098 Preview[7188] PostScript conversion message: /ComicSansMS-Bold
2005-12-30 11:43:37.121 Preview[7188] PostScript conversion message: /Copperplate-Light
2005-12-30 11:43:37.136 Preview[7188] PostScript conversion message: /Copperplate-Bold
2005-12-30 11:43:37.176 Preview[7188] PostScript conversion message: /Copperplate
2005-12-30 11:43:37.183 Preview[7188] PostScript conversion message: /CorsivaHebrew
2005-12-30 11:43:37.188 Preview[7188] PostScript conversion message: /CorsivaHebrew-Bold
2005-12-30 11:43:37.341 Preview[7188] PostScript conversion message: /CourierNewPSMT
2005-12-30 11:43:37.351 Preview[7188] PostScript conversion message: /CourierNewPS-BoldMT
2005-12-30 11:43:37.357 Preview[7188] PostScript conversion message: /CourierNewPS-ItalicMT
2005-12-30 11:43:37.361 Preview[7188] PostScript conversion message: /CourierNewPS-BoldItalicMT
2005-12-30 11:43:37.365 Preview[7188] PostScript conversion message: /DecoTypeNaskh
2005-12-30 11:43:37.403 Preview[7188] PostScript conversion message: /DevanagariMT
2005-12-30 11:43:37.457 Preview[7188] PostScript conversion message: /DevanagariMT-Bold
2005-12-30 11:43:37.509 Preview[7188] PostScript conversion message: /Didot
2005-12-30 11:43:37.514 Preview[7188] PostScript conversion message: /Didot-Italic
2005-12-30 11:43:37.540 Preview[7188] PostScript conversion message: /Didot-Bold
2005-12-30 11:43:37.569 Preview[7188] PostScript conversion message: /EuphemiaUCAS-Bold
2005-12-30 11:43:37.588 Preview[7188] PostScript conversion message: /EuphemiaUCAS-Italic
2005-12-30 11:43:37.635 Preview[7188] PostScript conversion message: /EuphemiaUCAS
2005-12-30 11:43:37.669 Preview[7188] PostScript conversion message: /Futura-Medium
2005-12-30 11:43:37.704 Preview[7188] PostScript conversion message: /Futura-CondensedMedium
2005-12-30 11:43:37.716 Preview[7188] PostScript conversion message: /Futura-CondensedExtraBold
2005-12-30 11:43:37.726 Preview[7188] PostScript conversion message: /Futura-MediumItalic
2005-12-30 11:43:37.739 Preview[7188] PostScript conversion message: /GenevaCY
2005-12-30 11:43:37.789 Preview[7188] PostScript conversion message: /Georgia
2005-12-30 11:43:37.792 Preview[7188] PostScript conversion message: /Georgia-Bold
2005-12-30 11:43:37.800 Preview[7188] PostScript conversion message: /Georgia-Italic
2005-12-30 11:43:37.806 Preview[7188] PostScript conversion message: /Georgia-BoldItalic
2005-12-30 11:43:37.817 Preview[7188] PostScript conversion message: /GillSans-BoldItalic
2005-12-30 11:43:37.824 Preview[7188] PostScript conversion message: /GillSans
2005-12-30 11:43:37.848 Preview[7188] PostScript conversion message: /GillSans-Italic
2005-12-30 11:43:37.854 Preview[7188] PostScript conversion message: /GillSans-Bold
2005-12-30 11:43:37.860 Preview[7188] PostScript conversion message: /GillSans-LightItalic
2005-12-30 11:43:37.873 Preview[7188] PostScript conversion message: /GillSans-Light
2005-12-30 11:43:37.986 Preview[7188] PostScript conversion message: /GujaratiMT
2005-12-30 11:43:38.036 Preview[7188] PostScript conversion message: /GujaratiMT-Bold
2005-12-30 11:43:38.041 Preview[7188] PostScript conversion message: /MonotypeGurmukhi
2005-12-30 11:43:38.048 Preview[7188] PostScript conversion message: /HelveticaCYPlain
2005-12-30 11:43:38.064 Preview[7188] PostScript conversion message: /HelveticaCYOblique
2005-12-30 11:43:38.068 Preview[7188] PostScript conversion message: /HelveticaCYBold
2005-12-30 11:43:38.072 Preview[7188] PostScript conversion message: /HelveticaCYBoldOblique
2005-12-30 11:43:38.102 Preview[7188] PostScript conversion message: /HelveticaNeue-UltraLight
2005-12-30 11:43:38.107 Preview[7188] PostScript conversion message: /HelveticaNeue-BoldItalic
2005-12-30 11:43:38.118 Preview[7188] PostScript conversion message: /HelveticaNeue-LightItalic
2005-12-30 11:43:38.180 Preview[7188] PostScript conversion message: /HelveticaNeue-Bold
2005-12-30 11:43:38.188 Preview[7188] PostScript conversion message: /HelveticaNeue
2005-12-30 11:43:38.192 Preview[7188] PostScript conversion message: /HelveticaNeue-Italic
2005-12-30 11:43:38.201 Preview[7188] PostScript conversion message: /HelveticaNeue-Light
2005-12-30 11:43:38.286 Preview[7188] PostScript conversion message: /HelveticaNeue-UltraLightItalic
2005-12-30 11:43:38.290 Preview[7188] PostScript conversion message: /HelveticaNeue-CondensedBlack
2005-12-30 11:43:38.295 Preview[7188] PostScript conversion message: /HelveticaNeue-CondensedBold
2005-12-30 11:43:38.306 Preview[7188] PostScript conversion message: /Herculanum
2005-12-30 11:43:38.340 Preview[7188] PostScript conversion message: /HoeflerText-Black
2005-12-30 11:43:38.389 Preview[7188] PostScript conversion message: /HoeflerText-Italic
2005-12-30 11:43:38.452 Preview[7188] PostScript conversion message: /HoeflerText-Regular
2005-12-30 11:43:38.457 Preview[7188] PostScript conversion message: /HoeflerText-Ornaments
2005-12-30 11:43:38.521 Preview[7188] PostScript conversion message: /HoeflerText-BlackItalic
2005-12-30 11:43:38.612 Preview[7188] PostScript conversion message: /Impact
2005-12-30 11:43:38.675 Preview[7188] PostScript conversion message: /InaiMathi
2005-12-30 11:43:39.594 Preview[7188] PostScript conversion message: /SIL-Kai-Reg-Jian
2005-12-30 11:43:39.678 Preview[7188] PostScript conversion message: /Krungthep
2005-12-30 11:43:39.683 Preview[7188] PostScript conversion message: /KufiStandardGK
2005-12-30 11:43:39.750 Preview[7188] PostScript conversion message: /MarkerFelt-Wide
2005-12-30 11:43:39.770 Preview[7188] PostScript conversion message: /MarkerFelt-Thin
2005-12-30 11:43:39.777 Preview[7188] PostScript conversion message: /MshtakanBold
2005-12-30 11:43:39.782 Preview[7188] PostScript conversion message: /MshtakanBoldOblique
2005-12-30 11:43:39.788 Preview[7188] PostScript conversion message: /MshtakanOblique
2005-12-30 11:43:39.816 Preview[7188] PostScript conversion message: /Mshtakan
2005-12-30 11:43:39.825 Preview[7188] PostScript conversion message: /Nadeem
2005-12-30 11:43:39.833 Preview[7188] PostScript conversion message: /NewPeninimMT
2005-12-30 11:43:39.838 Preview[7188] PostScript conversion message: /NewPeninimMT-Bold
2005-12-30 11:43:39.848 Preview[7188] PostScript conversion message: /NewPeninimMT-BoldInclined
2005-12-30 11:43:39.851 Preview[7188] PostScript conversion message: /NewPeninimMT-Inclined
2005-12-30 11:43:39.877 Preview[7188] PostScript conversion message: /Optima-ExtraBlack
2005-12-30 11:43:39.950 Preview[7188] PostScript conversion message: /Optima-Italic
2005-12-30 11:43:39.966 Preview[7188] PostScript conversion message: /Optima-Regular
2005-12-30 11:43:39.975 Preview[7188] PostScript conversion message: /Optima-Bold
2005-12-30 11:43:39.987 Preview[7188] PostScript conversion message: /Optima-BoldItalic
2005-12-30 11:43:40.046 Preview[7188] PostScript conversion message: /Papyrus
2005-12-30 11:43:40.103 Preview[7188] PostScript conversion message: /PlantagenetCherokee
2005-12-30 11:43:40.128 Preview[7188] PostScript conversion message: /ProFont
2005-12-30 11:43:40.134 Preview[7188] PostScript conversion message: /Raanana
2005-12-30 11:43:40.137 Preview[7188] PostScript conversion message: /RaananaBold
2005-12-30 11:43:40.183 Preview[7188] PostScript conversion message: /Sathu
2005-12-30 11:43:40.220 Preview[7188] PostScript conversion message: /Silom
2005-12-30 11:43:40.317 Preview[7188] PostScript conversion message: /Skia-Regular
2005-12-30 11:43:40.363 Preview[7188] PostScript conversion message: /Thonburi
2005-12-30 11:43:40.391 Preview[7188] PostScript conversion message: /TimesNewRomanPSMT
2005-12-30 11:43:40.406 Preview[7188] PostScript conversion message: /TimesNewRomanPS-BoldMT
2005-12-30 11:43:40.410 Preview[7188] PostScript conversion message: /TimesNewRomanPS-ItalicMT
2005-12-30 11:43:40.417 Preview[7188] PostScript conversion message: /TimesNewRomanPS-BoldItalicMT
2005-12-30 11:43:40.499 Preview[7188] PostScript conversion message: /TrebuchetMS
2005-12-30 11:43:40.503 Preview[7188] PostScript conversion message: /TrebuchetMS-Bold
2005-12-30 11:43:40.508 Preview[7188] PostScript conversion message: /TrebuchetMS-Italic
2005-12-30 11:43:40.517 Preview[7188] PostScript conversion message: /Trebuchet-BoldItalic
2005-12-30 11:43:40.545 Preview[7188] PostScript conversion message: /Verdana
2005-12-30 11:43:40.548 Preview[7188] PostScript conversion message: /Verdana-Bold
2005-12-30 11:43:40.565 Preview[7188] PostScript conversion message: /Verdana-Italic
2005-12-30 11:43:40.569 Preview[7188] PostScript conversion message: /Verdana-BoldItalic
2005-12-30 11:43:40.586 Preview[7188] PostScript conversion message: /Webdings
2005-12-30 11:43:40.774 Preview[7188] PostScript conversion message: /Zapfino
2005-12-30 11:43:42.162 Preview[7188] PostScript conversion message: /LiSongPro
2005-12-30 11:43:43.993 Preview[7188] PostScript conversion message: /STFangsong
2005-12-30 11:43:45.332 Preview[7188] PostScript conversion message: /STSong
2005-12-30 11:43:46.589 Preview[7188] PostScript conversion message: /STKaiti
2005-12-30 11:43:46.748 Preview[7188] PostScript conversion message: /AbadiMT-CondensedExtraBold
2005-12-30 11:43:46.867 Preview[7188] PostScript conversion message: /AbadiMT-CondensedLight
2005-12-30 11:43:46.876 Preview[7188] PostScript conversion message: /AndaleMono
2005-12-30 11:43:46.902 Preview[7188] PostScript conversion message: /ArialMT
2005-12-30 11:43:46.932 Preview[7188] PostScript conversion message: /Arial-BoldMT
2005-12-30 11:43:46.949 Preview[7188] PostScript conversion message: /Arial-ItalicMT
2005-12-30 11:43:46.962 Preview[7188] PostScript conversion message: /Arial-BoldItalicMT
2005-12-30 11:43:46.967 Preview[7188] PostScript conversion message: /Arial-Black
2005-12-30 11:43:46.972 Preview[7188] PostScript conversion message: /ArialNarrow
2005-12-30 11:43:46.976 Preview[7188] PostScript conversion message: /ArialNarrow-Bold
2005-12-30 11:43:46.994 Preview[7188] PostScript conversion message: /ArialNarrow-Italic
2005-12-30 11:43:46.998 Preview[7188] PostScript conversion message: /ArialNarrow-BoldItalic
2005-12-30 11:43:47.008 Preview[7188] PostScript conversion message: /ArialRoundedMTBold
2005-12-30 11:43:47.119 Preview[7188] PostScript conversion message: /BaskOldFace
2005-12-30 11:43:47.219 Preview[7188] PostScript conversion message: /Bauhaus93
2005-12-30 11:43:47.242 Preview[7188] PostScript conversion message: /Bauhaus93
2005-12-30 11:43:47.258 Preview[7188] PostScript conversion message: /Bauhaus93
2005-12-30 11:43:47.308 Preview[7188] PostScript conversion message: /BellMT
2005-12-30 11:43:47.312 Preview[7188] PostScript conversion message: /BellMTBold
2005-12-30 11:43:47.316 Preview[7188] PostScript conversion message: /BellMTItalic
2005-12-30 11:43:47.327 Preview[7188] PostScript conversion message: /BernardMT-Condensed
2005-12-30 11:43:47.368 Preview[7188] PostScript conversion message: /BookAntiqua
2005-12-30 11:43:47.394 Preview[7188] PostScript conversion message: /BookAntiqua-Bold
2005-12-30 11:43:47.490 Preview[7188] PostScript conversion message: /BookAntiqua-Italic
2005-12-30 11:43:47.500 Preview[7188] PostScript conversion message: /BookAntiqua-BoldItalic
2005-12-30 11:43:47.638 Preview[7188] PostScript conversion message: /BookmanOldStyle
2005-12-30 11:43:47.664 Preview[7188] PostScript conversion message: /BookmanOldStyle-Bold
2005-12-30 11:43:47.683 Preview[7188] PostScript conversion message: /BookmanOldStyle-Italic
2005-12-30 11:43:47.696 Preview[7188] PostScript conversion message: /BookmanOldStyle-BoldItalic
2005-12-30 11:43:47.718 Preview[7188] PostScript conversion message: /Braggadocio
2005-12-30 11:43:47.754 Preview[7188] PostScript conversion message: /BritannicBold
2005-12-30 11:43:47.793 Preview[7188] PostScript conversion message: /BrushScriptMT
2005-12-30 11:43:47.832 Preview[7188] PostScript conversion message: /CalistoMT
2005-12-30 11:43:47.846 Preview[7188] PostScript conversion message: /CalisMTBol
2005-12-30 11:43:47.850 Preview[7188] PostScript conversion message: /CalistoMT-Italic
2005-12-30 11:43:47.853 Preview[7188] PostScript conversion message: /CalistoMT-BoldItalic
2005-12-30 11:43:47.941 Preview[7188] PostScript conversion message: /Century
2005-12-30 11:43:47.955 Preview[7188] PostScript conversion message: /CenturyGothic
2005-12-30 11:43:47.959 Preview[7188] PostScript conversion message: /CenturyGothic-Bold
2005-12-30 11:43:47.980 Preview[7188] PostScript conversion message: /CenturyGothic-Italic
2005-12-30 11:43:47.993 Preview[7188] PostScript conversion message: /CenturyGothic-BoldItalic
2005-12-30 11:43:48.067 Preview[7188] PostScript conversion message: /CenturySchoolbook
2005-12-30 11:43:48.096 Preview[7188] PostScript conversion message: /CenturySchoolbook-Bold
2005-12-30 11:43:48.136 Preview[7188] PostScript conversion message: /CenturySchoolbook-Italic
2005-12-30 11:43:48.221 Preview[7188] PostScript conversion message: /CenturySchoolbook-BoldItalic
2005-12-30 11:43:48.235 Preview[7188] PostScript conversion message: /ColonnaMT
2005-12-30 11:43:48.261 Preview[7188] PostScript conversion message: /ComicSansMS
2005-12-30 11:43:48.283 Preview[7188] PostScript conversion message: /ComicSansMS-Bold
2005-12-30 11:43:48.313 Preview[7188] PostScript conversion message: /CooperBlack
2005-12-30 11:43:48.327 Preview[7188] PostScript conversion message: /CopperplateGothic-Bold
2005-12-30 11:43:48.693 Preview[7188] PostScript conversion message: /CopperplateGothic-Light
2005-12-30 11:43:48.742 Preview[7188] PostScript conversion message: /CurlzMT
2005-12-30 11:43:48.837 Preview[7188] PostScript conversion message: /Desdemona
2005-12-30 11:43:48.877 Preview[7188] PostScript conversion message: /DuchampBold
2005-12-30 11:43:48.899 Preview[7188] PostScript conversion message: /EdwardianScriptITC
2005-12-30 11:43:48.950 Preview[7188] PostScript conversion message: /EngraversMT
2005-12-30 11:43:48.955 Preview[7188] PostScript conversion message: /EngraversMT-Bold
2005-12-30 11:43:48.963 Preview[7188] PostScript conversion message: /EurostileRegular
2005-12-30 11:43:48.966 Preview[7188] PostScript conversion message: /EurostileBold
2005-12-30 11:43:48.996 Preview[7188] PostScript conversion message: /FootlightMTLight
2005-12-30 11:43:49.127 Preview[7188] PostScript conversion message: /Garamond
2005-12-30 11:43:49.132 Preview[7188] PostScript conversion message: /Garamond-Bold
2005-12-30 11:43:49.135 Preview[7188] PostScript conversion message: /Garamond-Italic
2005-12-30 11:43:49.240 Preview[7188] PostScript conversion message: /Gentium
2005-12-30 11:43:49.267 Preview[7188] PostScript conversion message: /Gentium-Italic
2005-12-30 11:43:49.348 Preview[7188] PostScript conversion message: /GentiumAlt
2005-12-30 11:43:49.390 Preview[7188] PostScript conversion message: /GentiumAlt-Italic
2005-12-30 11:43:49.464 Preview[7188] PostScript conversion message: /Georgia
2005-12-30 11:43:49.469 Preview[7188] PostScript conversion message: /Georgia-Bold
2005-12-30 11:43:49.473 Preview[7188] PostScript conversion message: /Georgia-Italic
2005-12-30 11:43:49.515 Preview[7188] PostScript conversion message: /Georgia-BoldItalic
2005-12-30 11:43:50.352 Preview[7188] PostScript conversion message: /GillSans-UltraBold
2005-12-30 11:43:50.441 Preview[7188] PostScript conversion message: /GloucesterMT-ExtraCondensed
2005-12-30 11:43:50.489 Preview[7188] PostScript conversion message: /GoudyOldStyleT-Regular
2005-12-30 11:43:50.493 Preview[7188] PostScript conversion message: /GoudyOldStyleT-Bold
2005-12-30 11:43:50.517 Preview[7188] PostScript conversion message: /GoudyOldStyleT-Italic
2005-12-30 11:43:50.569 Preview[7188] PostScript conversion message: /HartingPlain
2005-12-30 11:43:50.617 Preview[7188] PostScript conversion message: /Haettenschweiler
2005-12-30 11:43:50.640 Preview[7188] PostScript conversion message: /Harrington
2005-12-30 11:43:50.722 Preview[7188] PostScript conversion message: /Impact
2005-12-30 11:43:50.735 Preview[7188] PostScript conversion message: /ImprintMT-Shadow
2005-12-30 11:43:50.761 Preview[7188] PostScript conversion message: /KinoMT
2005-12-30 11:43:50.853 Preview[7188] PostScript conversion message: /LucidaBlackletter
2005-12-30 11:43:50.889 Preview[7188] PostScript conversion message: /LucidaBright
2005-12-30 11:43:50.892 Preview[7188] PostScript conversion message: /LucidaBright-Demi
2005-12-30 11:43:50.900 Preview[7188] PostScript conversion message: /LucidaBright-Italic
2005-12-30 11:43:50.903 Preview[7188] PostScript conversion message: /LucidaBright-DemiItalic
2005-12-30 11:43:50.911 Preview[7188] PostScript conversion message: /LucidaCalligraphy-Italic
2005-12-30 11:43:50.952 Preview[7188] PostScript conversion message: /LucidaFax
2005-12-30 11:43:50.958 Preview[7188] PostScript conversion message: /LucidaFax-Demi
2005-12-30 11:43:50.961 Preview[7188] PostScript conversion message: /LucidaFax-Italic
2005-12-30 11:43:50.970 Preview[7188] PostScript conversion message: /LucidaFax-DemiItalic
2005-12-30 11:43:50.979 Preview[7188] PostScript conversion message: /LucidaHandwriting-Italic
2005-12-30 11:43:51.021 Preview[7188] PostScript conversion message: /LucidaSans
2005-12-30 11:43:51.024 Preview[7188] PostScript conversion message: /LucidaSans-Demi
2005-12-30 11:43:51.028 Preview[7188] PostScript conversion message: /LucidaSans-Italic
2005-12-30 11:43:51.057 Preview[7188] PostScript conversion message: /LucidaSans-DemiItalic
2005-12-30 11:43:51.088 Preview[7188] PostScript conversion message: /LucidaSans-Typewriter
2005-12-30 11:43:51.091 Preview[7188] PostScript conversion message: /LucidaSans-TypewriterBold
2005-12-30 11:43:51.094 Preview[7188] PostScript conversion message: /LucidaSans-TypewriterOblique
2005-12-30 11:43:51.099 Preview[7188] PostScript conversion message: /LucidaSans-TypewriterBoldOblique
2005-12-30 11:43:51.157 Preview[7188] PostScript conversion message: /MaturaMTScriptCapitals
2005-12-30 11:43:51.180 Preview[7188] PostScript conversion message: /Mistral
2005-12-30 11:43:51.192 Preview[7188] PostScript conversion message: /Modern-Regular
2005-12-30 11:43:51.217 Preview[7188] PostScript conversion message: /MonotypeCorsiva
2005-12-30 11:43:51.252 Preview[7188] PostScript conversion message: /MonotypeSorts
2005-12-30 11:43:52.928 Preview[7188] PostScript conversion message: /NewsGothicMT
2005-12-30 11:43:52.931 Preview[7188] PostScript conversion message: /NewsGothicMT-Bold
2005-12-30 11:43:52.934 Preview[7188] PostScript conversion message: /NewsGothicMT-Italic
2005-12-30 11:43:53.056 Preview[7188] PostScript conversion message: /Onyx
2005-12-30 11:43:53.194 Preview[7188] PostScript conversion message: /PerpetuaTitlingMT-Light
2005-12-30 11:43:53.197 Preview[7188] PostScript conversion message: /PerpetuaTitlingMT-Bold
2005-12-30 11:43:53.344 Preview[7188] PostScript conversion message: /Playbill
2005-12-30 11:43:53.441 Preview[7188] PostScript conversion message: /Rockwell
2005-12-30 11:43:53.445 Preview[7188] PostScript conversion message: /Rockwell-Bold
2005-12-30 11:43:53.448 Preview[7188] PostScript conversion message: /Rockwell-Italic
2005-12-30 11:43:53.454 Preview[7188] PostScript conversion message: /Rockwell-BoldItalic
2005-12-30 11:43:53.470 Preview[7188] PostScript conversion message: /Rockwell-ExtraBold
2005-12-30 11:43:53.503 Preview[7188] PostScript conversion message: /Stencil
2005-12-30 11:43:53.513 Preview[7188] PostScript conversion message: /Tahoma
2005-12-30 11:43:53.518 Preview[7188] PostScript conversion message: /Tahoma-Bold
2005-12-30 11:43:53.594 Preview[7188] PostScript conversion message: /TimesNewRomanPSMT
2005-12-30 11:43:53.606 Preview[7188] PostScript conversion message: /TimesNewRomanPS-BoldMT
2005-12-30 11:43:53.621 Preview[7188] PostScript conversion message: /TimesNewRomanPS-ItalicMT
2005-12-30 11:43:53.652 Preview[7188] PostScript conversion message: /TimesNewRomanPS-BoldItalicMT
2005-12-30 11:43:53.779 Preview[7188] PostScript conversion message: /TrebuchetMS
2005-12-30 11:43:54.607 Preview[7188] PostScript conversion message: /TrebuchetMS-Bold
2005-12-30 11:43:54.615 Preview[7188] PostScript conversion message: /TrebuchetMS-Italic
2005-12-30 11:43:54.682 Preview[7188] PostScript conversion message: /Trebuchet-BoldItalic
2005-12-30 11:43:54.856 Preview[7188] PostScript conversion message: /Verdana
2005-12-30 11:43:54.872 Preview[7188] PostScript conversion message: /Verdana-Bold
2005-12-30 11:43:54.884 Preview[7188] PostScript conversion message: /Verdana-Italic
2005-12-30 11:43:54.909 Preview[7188] PostScript conversion message: /Verdana-BoldItalic
2005-12-30 11:43:55.096 Preview[7188] PostScript conversion message: /LatinWide
2005-12-30 11:43:55.146 Preview[7188] PostScript conversion message: /Wingdings
2005-12-30 11:43:55.160 Preview[7188] PostScript conversion message: /Wingdings2
2005-12-30 11:43:55.168 Preview[7188] PostScript conversion message: /Wingdings3
2005-12-30 11:43:55.195 Preview[7188] PostScript conversion message: /Courier
2005-12-30 11:43:55.200 Preview[7188] PostScript conversion message: /NotDefFont



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: dierauer on Dec 30, '05 09:08:07AM

I also observed this behavior on my first test, but my second test (converting the man page for bash - 60 pages in Preview) was quicker (~25 sec.), and didn't print anything to the Console log.

This was on a PowerMac G4/400 (Gigabit Ethernet) with 896 MB of RAM.

So still pretty slow; I doubt I'll switch to this method from the excellent Manopen.



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: rusto on Dec 30, '05 09:09:22AM
I also experienced a long "Converting Postscript file to PDF" wait, but only for the first time I tried the hint. Subsequent man pages opened in a couple of seconds.

[ Reply to This | # ]
You must have some front problems or...
Authored by: Sebhelyesfarku on Dec 30, '05 11:07:44AM

...something like this... It took 5-6sec to open a man page with the Preview method on my *400MHz G3* PowerBook...



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: johnl on Dec 30, '05 09:06:19AM

This is just a minor quibble, but the "-f" option is documented -- in open's man page (on Tiger, at least)!

Also, there's no need to specify the full path to Preview -- just this will work fine:

  man -t cat | open -f -a Preview


[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: megabulk on Dec 30, '05 09:50:44AM
You left out a quote on your example alias. Should be
alias pman "man -t !:* | open -f -a /Applications/Preview.app"


[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: ferret-slayer on Dec 30, '05 09:57:05AM

tcsh version:

alias pman 'man -t \!* | open -f -a /Applications/Preview.app'



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: Eryximakos on Dec 31, '05 02:39:12AM

Or just

alias pman='man -t "*" | open -f -a Preview'

in the bashrc file



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: magnamous on Dec 31, '05 10:19:34PM
This version in my .bash_profile file brings up the man page for ZSHZLE(1) no matter what I type. I've tried using pman bash, pman mkdir, pman ls, pman man, etc. Everything comes up as a 21-page ZSHZLE(1) document in Preview.

Does anyone have any suggestions as to what could be wrong? Thanks.

[ Reply to This | # ]
gv as an alternate
Authored by: gshenaut on Dec 30, '05 11:01:50AM
If you run X windows, here is a script (pipegv) I've used for a long time, based on the standard "gv" X11 postscript viewer:

#!/bin/sh

if [ "$1" = "" ] ; then
        T=/tmp/pipgv.$$
        trap "rm -f $T" EXIT INT
        cat > $T
        gv $T
else
        gv $*
fi
You can use "man -t whatever | pipegv" to look at neatly formated man pages.

Greg Shenaut

[ Reply to This | # ]

10.4: Use Preview to view formatted man pages
Authored by: doctype on Dec 30, '05 12:10:42PM
Well, here is my 'pman' version of a man-to-pdf convenience script. It first checks for available man pages, then converts the man page to pdf, stores it at a configurable location and then opens it in Preview. If a pdf already exists, the conversion will be left out.

#! /bin/sh

# configure your directory for storage of created PDF (with trailing slash)
pmanpath='/Absolute/path/to/store/location/'

if [ "$1" ]
then
	pdffile="${pmanpath}${1}.pdf"
	if [ -r "${pdffile}" ]
	then
		echo -n "PDF already exists at location "
		echo "${pdffile}"
		open "${pdffile}"
	else
		mantest=`man -w ${1}`
		if [ -z "${mantest}" ]
		then
			echo "No PDF created"
		else
			man -t "$1" | ps2pdf - "${pdffile}"
			if [ -r "${pdffile}" ]
			then
				echo -n "PDF created at location "
				echo "${pdffile}"
				open "${pdffile}"
			else
				echo "Couldn't create PDF for some mysterious reasons"
			fi
		fi
	fi
fi


[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: aalegado on Dec 31, '05 03:08:18PM
I didn't have 'ps2pdf' on my system (Tiger, 10.4.3). Instead, I had 'pstopdf' so the original script didn't work for me. I came up with something a little different based on doctype's script.

#! /bin/sh
pathtopdfs='/Absolute/path/to/folder/for/PDFs'
pdffile="$1.pdf"

cd "$pathtopdfs"

if [ "$1" ]
then
	if [ -r "$pdffile" ]
	then
		echo "The PDF for that man page already exists. Here it is..."
		open "$pdffile"
	else
		echo "The PDF for that man page does not exist. Creating it now..."
		man -t "$1" | pstopdf -i -o "$pdffile"
		open "$pdffile" 
	fi
else
	echo "No command specified. Exiting..."
fi
If your intended storage location for the PDFs has spaces in the directory name (e.g. a folder in your Documents folder named "PDFs of man commands"), you can get away with something like:

'/Users/username/Documents/PDFs of man commands'
Also note that the trailing slash isn't needed since I'm using this variable differently.

[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: komakino@myvarmi on Jan 01, '06 08:49:36PM

Great script! It should be mentioned that ghostscript needs to be installed in order for the ps2pdf function to be available. You can get it via the Fink or Darwinports projects.



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: feardiagh on Dec 30, '05 12:50:45PM
An applescript I whipped up for even lazier peoples. It has no error catching or anything of that nature, but it doesn't do anything bad if you feed it garbage, just opens preview and enters a couple of file not found lines in your log. Anyway, here it is. Enjoy:


set user_input to display dialog "Plese enter the man page to format." default answer "man" buttons "Format" default button "Format"
set manpage to text returned of user_input
set command to "man -t " & manpage & " | open -f -a /Applications/Preview.app"
do shell script command



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: aaronrp on Dec 30, '05 12:52:30PM
I've been using the following little csh script to print manual pages:

#!/bin/csh
set myman=(`man -w $*`)
groff -man -Tps -fN $myman | lp -o sides=two-sided-long-edge -d myprinter
But I like this better, because I can view it in Preview and then use whatever printer and options I want using the GUI. The only thing is that it uses Times, not New Century Schoolbook, to format the pages. (Why do I care? Pure nostalgia -- when I got to UC Santa Cruz back in 1988, the man pages they distributed for our Unix system were all in New Century Schoolbook.) It turns out you can modify the "TROFF" line in /usr/share/misc/man.conf to add the -fN line. Other valid fonts are -fA for Avant Garde, -fBM for Bookman, -fC for Courier, -fH for Helvetica, -fHN for Helvetica Narrow, or -fP for Palatino.

[ Reply to This | # ]
Switching to us-letter using man.conf
Authored by: charlesa on Jan 04, '06 01:44:56PM

You can also modify /usr/share/misc/man.conf to get USLetter (instead of A4) output by adding:

-P-pletter

to the TROFF entry. See the grops(1) manpage for further options.



[ Reply to This | # ]
Sogudi output looks nicer
Authored by: jscarry on Dec 30, '05 05:01:57PM
I installed Sogudi into Safari and it lets you view man pages with a simple man:whatever in the URL. I like its look better than Preview. It has a bunch of other shortcuts as well.

[ Reply to This | # ]
Or Bwana
Authored by: MattHaffner on Dec 30, '05 06:29:29PM

If you just want the "man:" prefix added, Bwana has been a long-time simple favorite of mine:

http://www.bruji.com/bwana/index.html



[ Reply to This | # ]
Sogudi output looks nicer
Authored by: sjk on Dec 31, '05 05:05:27PM

Thanks for the reminder.



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: mayo2ca on Dec 30, '05 05:19:29PM

The exclamation mark (!) should be escaped in order for this to work properly, otherwise the previous event will be substituted, so it should be:
alias pman "man -t \!:* | open -f -a Preview"
Also, it's nicer to specify just the app name for people who like to organize their Application folders and for portability.

If you want the output in font other than Times New, use
alias pman "man -w \!:* | xargs /usr/bin/groff -T ps -mandoc -f H | open -f -a Preview"

H as in Helvetica. C would output it in Courier. To check out the fonts available to groff run:
grep internalname /usr/share/groff/1.19.1/font/devps/*

the font name is the first character of the filename. It's possible to convert trutype fonts from the system's fonts directory, but that's outside of the scope here. Have fun with google. It's multistep process requiring bunch of utilities not installed on OSX out of the box (or at all), so I won't go into the details.

regards,
m



[ Reply to This | # ]
Thanks!
Authored by: Sebast1aan on Jan 02, '06 05:00:50AM

Thanks!

This is the best hint this year!... he he he.. But seriously it's really, really nice.

Btw. I'm using the bash script version mshmgi posted:

#!/bin/bash
mpg=$1;
if [ ! $mpg ];then
echo "Enter man page to read: ";
read mpg;
fi
if [ ! $mpg ];then
exit;
fi
man -t $mpg | open -f -a /Applications/Preview.app;
exit;



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: KenS on Jan 02, '06 07:31:08AM

This tip need not be limited to Tiger.

You can translate and open formatted postscript man pages with Preview in Panther or any of the earlier versions of OS X with this Unix one-liner:


man -t whatever >/tmp/"tmp.ps"; open /tmp/"tmp.ps"





[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: sjk on Jan 02, '06 02:40:29PM
Or simply: man -t name | open -f -a Preview

[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: sjk on Jan 02, '06 02:41:55PM

Oh, sorry, I guess that doesn't work before 10.4.



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: Wetzel on Jan 02, '06 03:41:05PM

from looking at the hints and comments, here's a streamlined version you can just put in your .profile or .bash_profile:

pman() {
man -t "$@" | ps2pdf - - | open -f -a Preview
}

you'll need to install the "ghostscript" package from fink or darwinports, because apple's pstopdf won't output to a pipe and Preview takes way too long to convert postscript to pdf -- ps2pdf is almost instantaneous.



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: robleach on Jan 03, '06 02:13:44PM
This also works for parameter substitution in a tcsh alias (using single quotes):
\!*
I'd never seen !:* before. Can anyone explain it? I understand using \!* because it's like escaping the !, but what does the colon do? Rob

[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: jack_givens on Jan 04, '06 06:58:17AM

I have done something similar to this for some time but I attempt to create a permanent PDF so that Spotlight can find the text in PDFs when I do a search. The script below will take a long time to proccess man pages and will sometimes fail on certain (poorly formed?) man pages. Once you run the script and Spotlight has done an update you will have many unix commands available for searching!



#! /bin/sh

TARGETDIR=~/Sites/MAN
[ -d "$TARGETDIR" ] || mkdir "$TARGETDIR"

for MDIR in /usr/share/man /usr/local/share/man /usr/X11R6/man
do
echo "${MDIR}..."
find "$MDIR" -type f | egrep ".[0-9]$" |
while read FILE
do
MANPAGE=`basename $FILE | cut -d. -f1`
echo -n "MANPAGE $MANPAGE"
man -t $MANPAGE | pstopdf -o "${TARGETDIR}/${MANPAGE}.pdf" -i
echo "...done"
done
done



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: Sesquipedalian on May 31, '07 10:50:27PM
I like this hint, but while a PDF is pretty, my goal is the fastest and easiest to use display of a man page I can possibly get. What I really wanted was plain text in a nice scrollable TextEdit window instead of a PDF in Preview. So I put this into my .profile:
tman()
{
man "${1}" | col -b | open -f -a "TextEdit"
}
It is practically instantaneous, and it lets me use all the functions of TextEdit.

[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: emailboy on May 21, '08 08:56:12AM

I modified the scripts and suggestions to save the converted PDF in the caches directory, and to check there first. If the file exists, it is opened instead of converting another:

#!/bin/bash

#
# Opens man pages in Preview.
#
# The '-t' option to 'man' generates PostScript, which
# Preview can open.  However, Preview needs to first
# convert to PDF, which can take a while.  Hence, we
# save generated pages in a cache directory, and look
# there first.  Also, this allows us to save the page
# with the 'man' entry as its name, which causes the
# Preview window to have that title.
#

if [ $# -eq 0 ]; then
    X=$(basename "$0")
    echo "$X: opens man pages in Preview"
    echo "Usage: $X man parameters" 
    exit 1
fi

# Cache directory.  Change to taste.
cachdir="${HOME}/Library/Caches/manpages"

# man page is last parameter, which is tricky to get
eval man=$$#

# file to save man page as PDF
manfile="${cachdir}/${man}"

# Create cache directory for 'man' output
mkdir -p "$cachdir"

# If desired PDF man page is in cache, open it
if [ -f "$manfile" ]; then
    open -a Preview "$manfile"
else
    # Invoke 'man' to check if man page exists, and if so,
    # invoke man to format it to PS, pipe PS output to pstopdf,
    # save result in cache
    man -w $* >/dev/null
    if [ $? -eq 0 ]; then
        man -t $* | pstopdf -o "$manfile" -i
        open -a Preview "$manfile"
    fi
fi



[ Reply to This | # ]
10.4: Use Preview to view formatted man pages
Authored by: retractable on Feb 03, '10 06:53:56AM
This really helped with my old mac thanks retractable lanyards

[ Reply to This | # ]