I want to get man pages to stout. However, I have not managed a way to do that.
Pseudo-code about what I am trying to achieve
man man | lpr
How can you print a manual, such that you see first how many pages is going to be printed?
I want to get man pages to stout. However, I have not managed a way to do that.
Pseudo-code about what I am trying to achieve
man man | lpr
How can you print a manual, such that you see first how many pages is going to be printed?
man -Tps man | lpr
This tells man to format the output as a postscript file which can be piped directly to a printer. See the man page for further -T (troff) formatting options.
To preview the output pipe it to a file and view it with gv or okular.
man -Tps man > manual.ps
gv manual.ps
man ls | col -b | lpr -P my_printer
This prints the man page for "ls" formats it using "col" and then prints on the printer named "my_printer"
The formatting isn't required, but gets rid of special characters making it easier to read.
Newer versions of man (at least my version on openSuSE 11 :) ) automatically detect if output is a terminal or a pipe. If you want non-formatted man pages to stdout, try:
man man | cat
For manpages going to the printer, I like:
man man | a2ps --stdin='man(1)'
Answer to # of pages question above(need 50 rep to add comments):
man ls | wc -l | awk '{ print $1/60 }'
The default # of lines per page is 60, so if you aren't changing that, then just divide by 60 and round up. I forget how to make awk treat FP as INT so that it rounds for you.