how do I select pages using lpr

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
kaykav

how do I select pages using lpr

Post by kaykav »

Hi,
Maybe someone can direct me to the answer. Using the command 'lpr' to print a 4 page file; what option or cmd do I use to just print the first 2 pages?
I can use the GUI dialog box,it gives me the option to select the range of pages,but how do I do that in the terminal?
Thank you.........
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
thenewguy

Re: how do I select pages using lpr

Post by thenewguy »

I'm not sure that lpr has a command switch to do that. If the file is text, you might be better off making a copy of the first two pages and saving them in a separate file. Something like

cat old_file.txt | head -n 50 > new_file.txt

Should grab the first 50 lines and dump them in a new file, which you could then print.
pompom

Re: how do I select pages using lpr

Post by pompom »

Welcome to Linux Mint!

Suppose you wanted to print pages 5 and 6 out of 8 page total of my_letter, you would specify options with -o

Code: Select all

lpr -P myprinter -o page-ranges=5-6 my_letter
lpr -P myprinter -o page-ranges=1,5-6 my_letter (including title page)
other options can equally be set

Code: Select all

lpr -P myprinter -o page-set=odd my_letter (just odd number pages)
lpr -P myprinter -o page-set=even my_letter (even number pages only)
Cheers,

pompom
kaykav

Re: how do I select pages using lpr

Post by kaykav »

pompom,
thank you for that info. works fine. most of the time man -pages are ambiguous. thanks..............
Locked

Return to “Beginner Questions”