The question is: how do you print only part of a man page?

Currently I do zcat manpage.1.gz | vim - and just remove everything I don't want to print. Then I pass that through groff and lpr. Are there better methods?

3 Answers 3


If you want to easily print a man doc I usually do it the graphical way:

man -Hfirefox command

Then you can print certain pages in your web browser. This isn't as powerful as doing it through the command line but it's a lot easier to get right since you can actually see what you're printing ahead of time. This may be important if you want to print a landscape document or something of that sort.

  • This is the best answer. Commented Jan 23, 2015 at 11:59

I know that you can print a whole man page at once, in plain monospaced text, by doing something like

man mc | col -b | lpr -P printername

Or to print it "pretty" (Serif font, bold, italics etc.) by doing

zcat /usr/share/man/man1/mc.1.gz | groff -man -Tps | lpr -P printername

As this basically sends a postscript file to the printer, you can also save it to a PostScript file by doing

zcat /usr/share/man/man1/mc.1.gz | groff -man -Tps > mc.ps

But I have no idea if you can easily extract a certain page, pages, or sections.

  • 1
    Some versions of the man command have a -t option as a shortcut for outputting postscript so you don't have to find the .1.gz file and type that long command, you can just man -t foo | lpr. On selecting sections, I doubt it can be done cleanly.
    – Alan Curry
    Commented Aug 12, 2012 at 19:00

How about:

man ls | sed -n "5, 8p;8q" > print_this.txt # get lines 5 to 8

Then print with

lp -d <printer> print_this.txt

(Hint: The option (-o) switches of lp are very useful!)

But better yet: open in your editor, then mark the region. In Emacs:

M-x man RET ls


M-x print-region

For this to work, the variable printer-name must be set. Or, use switches to lpr. (I see that you do not use Emacs, but this is of course possible in your editor as well.)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .