Is there a way to send a PDF file (or files) to the printer via the command line, but print only, say, odd-numbered pages? E.g., lpr -{some option} *.pdf Or perhaps {some command to get odd-numbered pages} *.pdf | lpr. This would be faster than opening each file, opening the Print dialogue, and telling it to print pages 1, 3, 5, 7, 9... The idea is to print all odd pages, then I can print the even numbered pages on the other side of the paper.



lpr -o page-set=odd <file>
lpr -o page-set=even <file>

You can find the documentation of this and other lpr options in the cups documentation.

  • @ fschmitt : Thanks, that worked perfectly! (Sorry, I can't figure out how to comment instead of leaving a whole answer.) – Wolf Oct 18 '10 at 12:53
  • Is there a manpage that collects all the possible lpr options? – Geremia Mar 30 '17 at 19:54

An alternative to the cups solution by fschmitt - for example if you only have some limited lpr available - is the command psselect.

For example for manual duplex printing in a printer without a duplex unit:

$ psselect -e -r < foo.ps | lpr
$ # manually rotate pages by 180 degrees and reinsert
$ psselect -o < foo.ps | lpr

Well, only works if your printer has a rock solid paper transport mechanism ...

-e selects only the even pages, -o odd ones, and -r reverses the selection


If you choose to preprocess the PDF (for example because your printing framework is not CUPS and doesn't support page selection), you can do it with pdftk.

pdftk A=foo.pdf cat Aodd output - | lpr
# take out the sheets and feed them back in
pdftk A=foo.pdf cat Bend-1even output - | lpr

Depending on how cheap your printer is, you may need to print the odd pages in reverse and the even pages in order: move end-1 to the other command. If the document has an odd number of pages, take out the last page from the stack and don't feed it back in the second time.

  • Hm, about the paper burning - the duplex models of HP printers I've come across always did some automatic re-inserting of the page to print on the backside, they did not print both sides at once. – maxschlepzig Oct 18 '10 at 9:21
  • @maxschlepzig: Yes, you're right, I've been overgeneralizing a valid point. Printing on the back of a sheet that's been around and has accumulated some bad stuff (specks of dirt, inkjet ink, small tears, …) could damage the paper or the printer, but reinserting the paper as it comes out of the printer for the first time is fine. – Gilles Oct 18 '10 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy