Skip to content

lp print command builder

Print from the command line

On a Mac or Linux machine, lp and lpr send a file to any printer with the copies, sides, paper and pages set. Pick the job and get the one line to paste in Terminal, then paste what lpoptions says to see what that printer can do. It runs in your browser: nothing you type or paste is sent to us.

25 double-sided black and white copies of worksheet.pdf to Copy_Room_Colour is an example. Change it to your job.

Command

Both are built into macOS and Linux with CUPS and take the same -o options.

Sides
Also

Run this in Terminal

On a Mac, open Terminal and cd to the file's folder first, or type its full path. On Linux, lp comes with CUPS. Windows has no lp; run it from a Mac or Linux machine, or Windows Subsystem for Linux with CUPS installed.

The command
lp -d Copy_Room_Colour -n 25 -o sides=two-sided-long-edge -o media=Letter -o print-color-mode=monochrome -o collate=true worksheet.pdf
-d Copy_Room_Colour
Sends it to Copy_Room_Colour.
-n 25
25 copies.
-o sides=two-sided-long-edge
Both sides, flipped like a book. For portrait pages.
-o media=Letter
On Letter, 8.5 by 11 paper.
-o print-color-mode=monochrome
In black and white, even on a colour printer.
-o collate=true
Each copy comes out as a full set, in order.

lp answers with a request id such as Copy_Room_Colour-112. A printer ignores an option it does not have, so check the first copy.

What can this printer do?

Run the second line, paste what it prints, and see its sides, paper, colour and finishing options.

  • lpstat -p -d

    Lists every printer by the name lp needs, and which one is the default.

  • lpoptions -p Copy_Room_Colour -l

    Lists the options this printer takes. Paste what it prints below.

  • lpstat -o

    Shows the jobs waiting, each with its job ID; cancel ID removes one.

lp command options for a school job

These are the standard CUPS options, which lp and lpr share; only the printer and copies flags differ. Settings like duplex, pages per sheet and collate mean the same here as in a print dialog. Run man lp for the full list.

lp and lpr options, the lpr form where it differs, and what each does
lplprWhat it does
-d NAME-P NAMEThe printer, by its CUPS queue name. Left out, the job goes to the default printer.
-n 25-# 25How many copies.
-o sides=two-sided-long-edgesameDouble-sided for portrait pages. two-sided-short-edge for landscape, one-sided to turn it off.
-o media=LettersameThe paper size, by the name lpoptions lists, such as Letter, Legal or Tabloid.
-o page-ranges=1-3,5sameOnly some pages of the file, in order.
-o number-up=2same2, 4, 6, 9 or 16 pages shrunk onto each side.
-o print-color-mode=monochromesameBlack and white on a colour printer. Some drivers use their own name, such as ColorModel=Gray.
-o collate=truesameEach copy comes out as a full set.
-o landscapesameTurns the pages a quarter turn.
-o fit-to-pagesameScales each page to the printable area.

lp or lpr?

Either. Both hand the job to CUPS, which sends it to the printer over IPP or whatever the queue was added with. lpr is the older BSD form, not the LPR protocol on port 515. A job that will not leave is cleared with the print queue clear command.

  • Queue names

    lpstat -p lists them. macOS writes spaces in a printer's name as underscores.

  • Set a default

    lpoptions -d NAME makes a printer the default for lp with no -d.

  • Keep options

    lpoptions -p NAME -o sides=two-sided-long-edge saves it for every later job to that printer.

  • Unknown option

    A printer quietly ignores an option it lacks. Print one copy first and check it.

Teachers send the file, not a command.

This builder writes one job from one computer. In KyberCopy teachers send from the request form, a preset carries the sides, paper and colour, it is checked against what each printer reports, and the relay prints it over IPP or port 9100.

Book a demo