← 返回命令列表

Linux command

lpr 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Print file

lpr [file]

Print to specific printer

lpr -P [printer] [file]

Print multiple copies

lpr -# [3] [file]

Print from stdin

cat [file] | lpr

Remove file after printing

lpr -r [file]

Title for job

lpr -T "[title]" [file]

说明

lpr submits files for printing. It sends one or more files to the default printer or a printer specified with -P. Files are queued and printed in the order submitted. On modern Linux systems, lpr is provided by CUPS (Common Unix Printing System). Without arguments, it reads from stdin, making it useful in pipelines (e.g., `ls | lpr`). Printer options like paper size and duplex can be set with -o.

参数

-P _PRINTER_
Destination printer.
-# _COPIES_
Number of copies.
-r
Remove file after printing.
-T _TITLE_
Job title.
-o _OPTION_
Printer option.
--help
Display help information.

FAQ

What is the lpr command used for?

lpr submits files for printing. It sends one or more files to the default printer or a printer specified with -P. Files are queued and printed in the order submitted. On modern Linux systems, lpr is provided by CUPS (Common Unix Printing System). Without arguments, it reads from stdin, making it useful in pipelines (e.g., `ls | lpr`). Printer options like paper size and duplex can be set with -o.

How do I run a basic lpr example?

Run `lpr [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -P _PRINTER_ do in lpr?

Destination printer.