lp Without Losing Track of the JobHit lp report.pdf on a shared machine and it can vanish onto whichever printer LPDEST happens to point at that day, not the one under your desk. This guide gets you submitting to CUPS with the destination you actually chose, checking the job, and handling copies, page ranges, two-sided printing and holds along the way. Allow about ten minutes, assuming CUPS and a printer are already configured.
These examples use lp from cups-client version 2.4.7-1.2ubuntu7.14. Printing normally needs no elevated privileges. Do not use sudo to submit a job unless your local printer policy explicitly requires it: a root-submitted job can have different authentication, ownership, defaults, and access to files.
Ask CUPS which printers it knows about and which destination is the default:
$ lpstat -p -d
Look for a line naming the printer you actually intend to use. If the command reports that the scheduler is not running, start or repair the CUPS service through your normal system administration process before continuing. If it reports no system default destination, use an explicit -d value rather than guessing.
lp checks LPDEST first, then PRINTER, then the default configured by lpoptions, and finally the server-side default. Those environment variables can quietly redirect a job, especially in scripts or remote sessions, so an explicit destination is the clearest choice:
$ lp -d OFFICE_PRINTER /path/to/report.pdf
Replace OFFICE_PRINTER with the exact name from lpstat. A successful submission returns a CUPS request identifier. Capture it; it is the handle used when changing or cancelling the job.
Use -n for copies, and give the job a useful title with -t. The title makes a shared queue easier to read:
$ lp -d OFFICE_PRINTER -n 2 -t "Quarterly report" /path/to/report.pdf
The default job priority is 50. If a queue policy allows it, -q accepts 1 through 100, with 100 highest:
$ lp -d OFFICE_PRINTER -q 60 -t "Meeting pack" /path/to/meeting-pack.pdf
Do not use priority as a substitute for permission or an agreed queue policy: a higher value may move your work ahead of somebody else's.
Checkpoint: list your own pending jobs and confirm the destination and title:
$ lpstat -o
-P takes a comma-separated list of output pages and ranges. Useful for a small extract, but page numbering can change when options such as number-up are used:
$ lp -d OFFICE_PRINTER -P 1,3-5 -t "Selected pages" /path/to/report.pdf
Job options use -o name=value. For example, this requests A4 paper, two document pages on each output sheet, and duplex portrait printing:
$ lp -d OFFICE_PRINTER \
-o media=a4 \
-o number-up=2 \
-o sides=two-sided-long-edge \
/path/to/notes.pdf
For pages wider than they are tall, use two-sided-short-edge instead. Printer-specific options are not universal: inspect the installed queue with lpoptions -p OFFICE_PRINTER -l before relying on a model-specific name. If a requested option is unsupported, CUPS or the printer may reject it or substitute a supported value.
When the printer must not start immediately, submit with -H hold:
$ lp -d OFFICE_PRINTER -H hold -t "Check before printing" /path/to/contract.pdf
A held job stays pending until it is resumed. Use lpstat -o to find its job identifier, then resume it:
$ lpstat -o
$ lp -i OFFICE_PRINTER-123 -H resume
Replace OFFICE_PRINTER-123 with the identifier returned by your queue: it is not a fixed universal format, so copy the value rather than constructing it.
You can also use -H HH:MM for a UTC release time. The manual specifies UTC, not local time, which is an easy source of early or late printing. Prefer hold when a human must inspect the document first.
A filename of - tells lp to read the document from standard input:
$ printf '%s\n' 'Temporary note' | lp -d OFFICE_PRINTER -t "Temporary note" -
For a real file whose name begins with a dash, put -- before the filename so it is not mistaken for an option:
$ lp -d OFFICE_PRINTER -- ./-invoice.pdf
Do not pipe sensitive material into a shared queue without checking who can see its title, content, and printed output. The -m option asks CUPS to send an email when the job completes, but it depends on the server and account being configured for mail.
Printing is a physical side effect. If you submitted the wrong file or too many copies, cancel the pending job before changing anything else:
$ lpstat -o
$ cancel OFFICE_PRINTER-123
$ lpstat -o
Replace the example identifier with the job you confirmed in the first command. The last command should no longer list that pending job.
Warning: cancellation cannot retrieve pages already printed, and a job may leave the queue between the two commands, so act promptly.
If the queue is paused or the printer is offline, do not repeatedly resubmit the same file. Inspect lpstat -p -d and lpstat -o first: repeated submissions commonly create duplicate output once the printer catches up.
lpstat, or supplied it explicitly with -d.lpstat -o.-H hold and resumed only after inspection.