• Post Reply Bookmark Topic Watch Topic
  • New Topic

printing man pages  RSS feed

 
Jason Kretzer
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can one print the man pages? Or at the very least pipe the formatted output of 'man <topic>' to a text file?
Thanks,
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
man sumpn > file.txt
or
man sumpn | lp
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is one of those no-so-frequently-asked questions. As I'm sure you you would find, Michael, if you tried this, you either lose the formatting, mess up the output, or get a whole bundle of _^H in an attempt to underline stuff.
Anyway, the classic solution is

see

for more details.
 
Jason Kretzer
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
I used a combination of the two replies.

It even kept the formatting.
Thanks a lot.
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alternatively there are various converters to turn manpages into HTML pages, for example you could use man2html or there are hypertext interfaces to manpages such as this one or that one.
My point being that once you've made them available as HTML pages it makes them very easy to print from any bogstandard windoze PC or macintosh assuming you have one available. A google search should yield more web-based manpages.
HTH.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Frank Carver:
This is one of those no-so-frequently-asked questions. As I'm sure you you would find, Michael, if you tried this, you either lose the formatting, mess up the output, or get a whole bundle of _^H in an attempt to underline stuff.
Anyway, the classic solution is

see

for more details.

Must be a Linux thing; I have no issues actually using this technique all the time on Solaris. I do remember running unix2dos against output to a file, but since I rarely want a file of a man page I don't think too much of the ^M's in the file.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not just the ^M, honest. By default, the output of "man" attempts to do underlining by emitting a character, a backspace and an underbar for each underlined character. The purpose of "col -b" is to process these sequences into acceptable printable output. I'm sure it was the same on Solaris last time I looked ( I haven't got access to a Solaris machine right now, or I would try it ).
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll try it today against a 'problematic' man page and post my findings. Now I'm curious.
 
Tim Holloway
Saloon Keeper
Posts: 18797
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Historically man boldfaced critical headings by backspacing and overprinting (something that works a lot easier on a teletype terminal than a laser printer).
Which is why the extra voodoo. Some printers will honor the backspace (though not so frequently will it overprint into boldface), but for the rest, you want that magic or you get ugliness.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!