lp
rose1 发表于 2020-10-02 07:57浏览次数:
On Unix-like operating systems, the lp command prints files.
目录:
1 lp 运行系统环境
2 lp 说明
3 lp 语法
4 lp 例子
lp 运行系统环境
lp 说明
lp提交文件进行打印,或更改挂起的打印作业。使用文件名“ - ”从标准输入中指定打印。
默认目的地
lp使用通用打印系统CUPS,提供了许多设置默认目的地的方法。该LPDEST和PRINTER 环境变量首先检查。如果没有设置,则使用lpoptions命令的当前默认设置,然后使用lpadmin命令的默认设置。
lp submits files for printing, or alters a pending print job. Use a file name of "-" to specify printing from the standard input.
Default Destination
lp uses the common printing system CUPS, providing many ways to set the default destination. The LPDEST and PRINTER environment variables are checked first. If neither are set, the current default set using the lpoptions command is used, followed by the default set using the lpadmin command.
lp 语法
lp -i request-ID [-c] [-m] [-p] [-s] [-w] [-d destination] [-f form-name]
[-H special-handling] [-n number] [-o options] [-p pagenumbers]
[-q priority-level] [-S character-set | print-wheel] [-t title]
[-T content-Type [-r]] [-y mode-list]
选件
--
|
标记选项的结束;用它来打印一个以破折号(-)开头的文件。
|
-E
|
连接到服务器时强制加密。
|
-U 用户名
|
指定连接到服务器时要使用的用户名。
|
-c
|
提供此选项仅是为了向后兼容。在支持该功能的系统上,此选项将强制在打印之前将打印文件复制到假脱机目录。在CUPS中,打印文件始终通过IPP发送到调度程序,这具有相同的效果。
|
-d 目的地
|
将文件打印到目标打印机。
|
-h主机名[ :端口]
|
选择备用服务器。
|
-i工作编号
|
指定要修改的现有作业。
|
-m
|
作业完成后发送电子邮件。
|
-n copies
|
从1到100设置要打印的份数。
|
-o “名称=值[名称=值...] ”
|
设置一个或多个作业选项。请参阅下面的选项表。
|
-q 优先级
|
将作业优先级从1(最低)设置为100(最高)。默认优先级为50。
|
-s
|
不要报告结果作业ID(静默模式)。
|
-t “名称”
|
设置作业名称。
|
-H hhhh :毫米
-H 保持
-H 立即
-H 重新启动
-H 恢复
|
指定何时打印作业。Instant的值将立即打印文件,Hold的值将无限期保存该作业,并且UTC时间值(HH :MM)将保留该作业直到指定的UTC(非本地)时间。使用带有-i选项的resume值可以恢复保留的作业。将重新启动的值与-i选项一起使用可重新启动已完成的作业。
|
-P 页面列表
|
指定要在文档中打印的页面。该列表可以包含由逗号(例如1,3-5,16)分隔的数字和范围(#- #)的列表。页码是指输出页,而不是文档的原始页-诸如“向上编号”之类的选项可能会影响页的编号。
|
选件
除了lpoptions命令报告的特定于打印机的选项之外,还可以使用以下通用选项:
-o media=大小
|
将页面大小设置为size。大多数打印机至少支持尺寸名称“ a4 ”,“ letter ”和“ legal ”。
|
-o landscape
-o 定向要求= 4
|
以横向(旋转90度)打印作业。
|
-o 侧面=一侧
-o 侧面=双面长边 -o 侧面=双面短边
|
在纸张的一面或两面打印。当打印纵向(未旋转)页面时,通常使用值“双面长边”,而对于横向页面则使用“双面短边”。
|
-o 适合页面
|
缩放打印文件以适合页面大小。
|
-o number-up=2
-o number-up=4
-o number-up=6
-o number-up=9
-o number-up=16
|
在每个输出页面上打印多个文档页面。
|
-o cpi=N
|
设置每英寸打印文本文件时使用的字符数。默认值为10。
|
-o lpi=N
|
设置每英寸打印文本文件时要使用的行数。默认值为6。
|
-o page-bottom=N
-o page-left=N
-o page-right=N
-o page-top=N
|
设置打印文本文件时的页边距。值以磅为单位-英寸为72点。
|
lp -i request-ID [-c] [-m] [-p] [-s] [-w] [-d destination] [-f form-name]
[-H special-handling] [-n number] [-o options] [-p pagenumbers]
[-q priority-level] [-S character-set | print-wheel] [-t title]
[-T content-Type [-r]] [-y mode-list]
Options
--
|
Marks the end of options; use this to print a file whose name begins with a dash (-).
|
-E
|
Forces encryption when connecting to the server.
|
-U username
|
Specifies the username to use when connecting to the server.
|
-c
|
This option is provided for backwards-compatibility only. On systems that support it, this option 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.
|
-d destination
|
Prints files to the destination printer.
|
-hhostname[:port]
|
Chooses an alternate server.
|
-i job-id
|
Specifies an existing job to modify.
|
-m
|
Sends an email when the job is completed.
|
-n copies
|
Sets the number of copies to print from 1 to 100.
|
-o "name=value [name=value ...]"
|
Sets one or more job options. See Options table below.
|
-q priority
|
Sets the job priority from 1 (lowest) to 100 (highest). The default priority is 50.
|
-s
|
Do not report the resulting job IDs (silent mode.)
|
-t "name"
|
Sets the job name.
|
-H hh:mm
-H hold
-H immediate
-H restart
-H resume
|
Specifies when the job should be printed. A value of immediate will print the file immediately, a value of hold will hold the job indefinitely, and a UTC time value (HH:MM) will hold the job until the specified UTC (not local) time. Use a value of resume with the -i option to resume a held job. Use a value of restart with the -i option to restart a completed job.
|
-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). 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.
|
Options
Aside from the printer-specific options reported by the lpoptions command, the following generic options are available:
-o media=size
|
Sets the page size to size. Most printers support at least the size names "a4", "letter", and "legal".
|
-o landscape
-o orientation-requested=4
|
Prints the job in landscape orientation (rotated 90 degrees).
|
-o sides=one-sided
-o sides=two-sided-long-edge -o sides=two-sided-short-edge
|
Prints on one or two sides of the paper. The value "two-sided-long-edge" is normally used when printing portrait (unrotated) pages, while "two-sided-short-edge" is used for landscape pages.
|
-o fit-to-page
|
Scales the print file to fit on the page.
|
-o number-up=2
-o number-up=4
-o number-up=6
-o number-up=9
-o number-up=16
|
Prints multiple document pages on each output page.
|
-o cpi=N
|
Sets the number of characters per inch to use when printing a text file. The default is 10.
|
-o lpi=N
|
Sets the number of lines per inch to use when printing a text file. The default is 6.
|
-o page-bottom=N
-o page-left=N
-o page-right=N
-o page-top=N
|
Sets the page margins when printing text files. The values are in points - there are 72 points to the inch.
|
lp 例子
lp -d myprinter -o media=legal -o sides=two-sided-long-edge file name
将双面法律文档文件名打印到打印机myprinter。
lp -d myprinter -o scaling=200 file name
跨4页打印文档文件名。
lp -d myprinter -o cpi=12 -o lpi=8 -o page-left=72 file name
打印一个文本文件,该文件每英寸12个字符,每英寸8行,左边距为1英寸。
lp -d myprinter -o media=legal -o sides=two-sided-long-edge file name
Prints the double-sided legal document file name to printer myprinter.
lp -d myprinter -o scaling=200 file name
Print document file name across 4 pages.
lp -d myprinter -o cpi=12 -o lpi=8 -o page-left=72 file name
Print a text file with 12 characters per inch, 8 lines per inch, and a 1 inch left margin.