lpr(1)

πŸ“¦
version 2.4.19 Β· 2 versions
, in centos-stream 10, fedora 43, fedora 44

πŸ’– lpr(1) β€” the OpenPrinting era of lpr, bestie edition πŸ’–

okay so you wanna print stuff from the terminal like a whole main character? periodt. this is lpr from the OpenPrinting girlies, and she is literally the moment. let's get into it. πŸŽ€


✨ NAME ✨

lpr β€” print files πŸ–¨οΈπŸ’…


🌸 SYNOPSIS 🌸

lpr [ -H server[:port] ] [ -E ] [ -U username ] [ -P
destination[/instance] ] [ -# num-copies [ -h ] [ -l ] [ -m ] [ -o
option[=value] ] [ -p ] [ -q ] [ -r ] [ -C title ] [ -J title ] [ -T
title ] [ file(s) ]

πŸ¦‹ DESCRIPTION πŸ¦‹

lpr submits files for printing. any files you name on the command line get sent to the printer you named β€” or to the default destination if you didn't name one. and if you list no files at all on the command line? she just reads the print file from standard input. iconic, honestly. ✨

πŸ‘‘ THE DEFAULT DESTINATION

CUPS gives you so many ways to set the default destination, bestie. here's the order of who gets consulted first:

  • the LPDEST and PRINTER environment variables β€” these get checked first, no cap.
  • if neither of those is set, the current default set using the lpoptions(1) command is used.
  • and after that, the default set using the lpadmin(8) command.

so basically: env vars, then lpoptions(1), then lpadmin(8). the way that's a whole priority queue 😭


πŸ’… OPTIONS πŸ’…

these are the options lpr actually recognizes, okurrr:

  • -E β€” forces encryption when connecting to the server. πŸ”’
  • -H server[:port] β€” specifies an alternate server. > note: this option must occur before all others. like, she needs to be first in line. she's the main character of the argument list. πŸ‘‘
  • -C "name"
  • -J "name"
  • -T "name" β€” sets the job name/title. ✏️
  • -P destination[/instance] β€” prints files to the named printer. πŸ–¨οΈ
  • -U username β€” specifies an alternate username. πŸ™ˆ
  • -# copies β€” sets the number of copies to print. πŸ”’
  • -h β€” disables banner printing. this one is equivalent to -o job-sheets=none. bye bye banner πŸ’€
  • -l β€” says the print file is already formatted for the destination and should be sent without filtering. equivalent to -o raw. straight up raw, no filter, no notes. ✨
  • -m β€” send an email on job completion. πŸ“§ bestie will let you know.
  • -o option[=value] β€” sets a job option. see "COMMON JOB OPTIONS" below. πŸ‘‡
  • -p β€” says the print file should be formatted with a shaded header with the date, time, job name, and page number. equivalent to -o prettyprint, and it's only useful when printing text files. so cute, so specific. πŸŽ€
  • -q β€” hold job for printing. she's waiting, bestie. ⏸️
  • -r β€” says the named print files should be deleted after submitting them. careful, that's permanent bestie 😭

🌈 COMMON JOB OPTIONS

besides the printer-specific options that lpoptions(1) reports, you also get these generic options. slay:

  • -o job-sheets=name β€” prints a cover page (banner) with the document. the "name" can be "classified", "confidential", "secret", "standard", "topsecret", or "unclassified". very spy-movie of you πŸ•΅οΈ
  • -o media=size β€” sets the page size to size. most printers support at least the size names "a4", "letter", and "legal".
  • -o number-up={2|4|6|9|16} β€” prints 2, 4, 6, 9, or 16 document (input) pages on each output page. multi-tasking icon behavior ✨
  • -o orientation-requested=4 β€” prints the job in landscape (rotated 90 degrees counter-clockwise).
  • -o orientation-requested=5 β€” prints the job in landscape (rotated 90 degrees clockwise).
  • -o orientation-requested=6 β€” prints the job in reverse portrait (rotated 180 degrees). upside down, living her truth πŸ™ƒ
  • -o print-quality=3
  • -o print-quality=4
  • -o print-quality=5 β€” specifies the output quality β€” draft (3), normal (4), or best (5). πŸ’…
  • -o sides=one-sided β€” prints on one side of the paper.
  • -o sides=two-sided-long-edge β€” prints on both sides of the paper for portrait output.
  • -o sides=two-sided-short-edge β€” prints on both sides of the paper for landscape output.

⚠️ NOTES ⚠️

okay listen. the -c, -d, -f, -g, -i, -n, -t, -v, and -w options are not supported by CUPS and will produce a warning message if you use them. so like, don't. πŸ’€


πŸ“ EXAMPLES πŸ“

print two copies of a document to the default printer:

lpr -# 2 filename

print a double-sided legal document to a printer called "foo":

lpr -P foo -o media=legal -o sides=two-sided-long-edge filename

print a presentation document 2-up to a printer called "foo":

lpr -P foo -o number-up=2 filename

🧚 SEE ALSO 🧚

cancel(1), lp(1), lpadmin(8), lpoptions(1), lpq(1), lprm(1), lpstat(1), CUPS Online Help (http://localhost:631/help)


Copyright Β© 2020-2024 by OpenPrinting.


and that's the whole page, bestie!! this was the lpr(1) page from the CUPS crew at OpenPrinting, dated 2022-05-02. go print something iconic. no cap. 🫢✨

πŸ“¦ where this page comes from