Skip to content

Instantly share code, notes, and snippets.

@jdmichaud
Last active May 2, 2026 14:28
Show Gist options
  • Select an option

  • Save jdmichaud/cce672c0049e8f0c930e35b1b4e98feb to your computer and use it in GitHub Desktop.

Select an option

Save jdmichaud/cce672c0049e8f0c930e35b1b4e98feb to your computer and use it in GitHub Desktop.
Printer/Printing from the CLI

Basic Options

Get the name of the printer

lpstat -p

Get the options:

lpoptions -p DCP1510 -l

Print:

lp -d DCP1510 file.pdf

Double sided with a non duplex printer:

lp -d DCP1510 -o page-set=odd file.pdf
lp -d DCP1510 -o page-set=even file.pdf

Flip the order so once the odd pages are printed, you print from the last even pages:

lp -d DCP1510 -o page-set=even -o outputorder=reverse file.pdf

Skip the first two page:

lp -d DCP1510 -o page-ranges=3- file.pdf

Select the resolution:

lp -d DCP1510 -o Resolution=2400x600dpi file.pdf

Printing a book

Combining all the options above:

$ lp -d DCP1510 -o page-set=odd -o page-ranges=3-98 -o Resolution=2400x600dpi book.pdf
$ lp -d DCP1510 -o page-set=even -o page-ranges=3-98 -o Resolution=2400x600dpi -o outputorder=reverse book.pdf

This will first print the odd page and then the even page in reverse order. The cover (front and back) will be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment