lp(1)
๐ lp(1) โ bestie's guide to printing files ๐
okay so this is the lp(1) page from the OpenPrinting manual, and honestly? it's iconic. it's the command that sends your stuff to the printer, and i'm gonna walk you through every single flag like we're sitting on the floor of my room with iced coffee. no cap. ๐
โจ NAME โจ
lp โ print files ๐จ๏ธ๐
๐ธ SYNOPSIS ๐ธ
lp [ -h hostname[:port] ] [ -E ] [ -U username ] [ -c ] [ -d
destination[/instance] ] [ -m ] [ -n num-copies ] [ -o option[=value] ]
[ -q priority ] [ -s ] [ -t title ] [ -H handling ] [ -P page-list ] [
-- ] [ file(s) ]
lp [ -h hostname[:port] ] [ -E ] [ -U username ] [ -c ] [ -i job-id ] [
-n num-copies ] [ -o option[=value] ] [ -q priority ] [ -t title ] [ -H
handling ] [ -P page-list ]
like, two whole forms โ one for printing files, one for messing with a job that's already out there. slay. โจ
๐ฆ DESCRIPTION ๐ฆ
lp submits files for printing, or alters a pending job. that's the whole vibe. ๐ซถ
and listen โ if you use a filename of "-", it forces printing from the standard input. stdin girlies rise. ๐ญ
๐ THE DEFAULT DESTINATION ๐
CUPS has so many ways to set the default destination, it's giving "too many options" energy. here's the actual order, bestie:
- the
LPDESTandPRINTERenvironment variables get consulted first ๐ฅ - if neither of those is set, it uses the current default set by the
lpoptions(1)command - and after that, the default set by the
lpadmin(8)command
periodt. that's the priority list. don't fight it.
๐ OPTIONS ๐
the following options are recognized by lp โ and yes, we're doing ALL of them. every single one. ๐
--โ marks the end of options. use this when you wanna print a file whose name begins with a dash (-). the classic gotcha, we love her.-Eโ forces encryption when connecting to the server. ๐ secure girl behavior.-U usernameโ specifies the username to use when connecting to the server.-cโ okay so this one is provided for backwards-compatibility only. on systems that support it, it forces the print file to be copied to the spool directory before printing. in CUPS, print files are always sent to the scheduler via IPP, which has the same effect anyway. so like. it's fine. it's giving legacy. ๐-d destinationโ prints files to the named printer. ๐ฏ-h hostname[:port]โ chooses an alternate server. โ ๏ธ note: this option must occur before all others. like, BEFORE. ALL. OTHERS. it's the main character, it goes first. ๐-i job-idโ specifies an existing job to modify. this is your "edit an already-posted post" energy. โ๏ธ-mโ sends an email when the job is completed. ๐ง so 2010s of it but okay bestie.-n copiesโ sets the number of copies to print. ๐ฏ-o "name=value [ ... name=value ]"โ sets one or more job options. see COMMON JOB OPTIONS below, we get into it. โจ-q priorityโ sets the job priority from1(lowest) to100(highest). the default priority is50. ๐-sโ do not report the resulting job IDs (silent mode.) ๐คซ mysterious. elusive. not like the other flags.-t "name"โ sets the job name. ๐ท๏ธ-H hh:mm-H hold-H immediate-H restart-H resumeโ specifies when the job should be printed. here's the breakdown, bestie:- a value of
immediatewill print the file immediately โก - a value of
holdwill hold the job indefinitely ๐ง - a UTC time value (
HH:MM) will hold the job until the specified UTC (not local!) time โฐ not local, fr fr - use a value of
resumewith the-ioption to resume a held job โถ๏ธ - use a value of
restartwith the-ioption to restart a completed job ๐
- a value of
-P page-listโ specifies which pages to print in the document. the list can contain a list of numbers and ranges (#-#) separated by commas, e.g.,"1,3-5,16". IMPORTANT: the page numbers refer to the output pages and not the document's original pages โ options like"number-up"can affect the numbering of the pages. ๐ญ so like, don't come for me when page 3 isn't page 3.
๐ COMMON JOB OPTIONS ๐
aside from the printer-specific options reported by the lpoptions(1) command, the following generic options are available โ and they're lowkey the most useful part of this whole page:
-o job-sheets=nameโ prints a cover page (banner) with the document. the"name"can be"classified","confidential","secret","standard","topsecret", or"unclassified". ๐ต๏ธ drama. intrigue. a banner.-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}โ prints2,4,6,9, or16document (input) pages on each output page. ๐๏ธ it's giving "cramming for finals."-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 and unbothered.-o print-as-rasterโ prints the job as raster. ๐ผ๏ธ-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. ๐
โญ CONFORMING TO โญ
unlike the System V printing system, CUPS allows printer names to contain any printable character except SPACE, TAB, "/", or "#". iconic, flexible, unbothered. also โ printer and class names are not case-sensitive. ๐
and now for the numbers bit, bestie, because it trips people up: the -q option accepts a different range of values than the Solaris lp command. it matches the IPP job priority values (1-100, 100 is highest priority) instead of the Solaris values (0-39, 0 is highest priority). โ ๏ธ so if you're used to Solaris, your brain is gonna do a little flip.
๐ฅ EXAMPLES ๐ฅ
print two copies of a document to the default printer:
lp -n 2 filename
print a double-sided legal document to a printer called "foo":
lp -d foo -o media=legal -o sides=two-sided-long-edge filename
print a presentation document 2-up to a printer called "bar":
lp -d bar -o number-up=2 filename
ate. no crumbs. ๐ซถ
๐ SEE ALSO ๐
cancel(1), lpadmin(8), lpoptions(1), lpq(1), lpr(1), lprm(1), lpstat(1), CUPS Online Help (http://localhost:631/help) ๐ฆ
๐ COPYRIGHT ๐
Copyright ยฉ 2020-2024 by OpenPrinting. ๐
okay bestie, that's the whole page โ and for the sign-off: this beauty is from CUPS, dated 2022-05-02, and it's the lp(1) page. go forth and print. you're gonna slay. ๐โจ๐
๐ฆ where this page comes from
- alpine 3.22: cups-doc 2.4.18-r0 ยท Apache-2.0
- alpine 3.23: cups-doc 2.4.18-r0 ยท Apache-2.0
- alpine 3.24: cups-doc 2.4.19-r1 ยท Apache-2.0
- nixpkgs unstable: cups 2.4.19
- opensuse-leap 16.0: cups-client 2.4.19-160000.2.1 ยท Apache-2.0
- opensuse-leap 16.0: cups-client 2.4.19-160000.2.1 ยท Apache-2.0
- opensuse-leap 16.0: cups-client 2.4.19-160000.2.1 ยท Apache-2.0
- opensuse-leap 16.0: cups-client 2.4.19-160000.2.1 ยท Apache-2.0
- ubuntu resolute: cups-client 2.4.16-1ubuntu1 ยท Apache-2.0-with-GPL2-LGPL2-Exception
- ubuntu resolute: cups-client 2.4.16-1ubuntu1.3 ยท Apache-2.0-with-GPL2-LGPL2-Exception
- ubuntu stonking: cups-client 2.4.16-1ubuntu3 ยท Apache-2.0-with-GPL2-LGPL2-Exception
- Copyright ยฉ 2020-2024 by OpenPrinting
- Copyright ยฉ 2007-2019 by Apple Inc
- Copyright ยฉ 1997-2006 by Easy Software Products
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms