Forrest logo
tool overview
On this page you find all important commands for the CLI tool lpr. If the command you are looking for is missing please ask our AI.

lpr

lpr is a command-line tool used in Unix-like operating systems to print files from the command line. The command stands for "line printer," emphasizing its historical association with line printers.

With lpr, users can send files to print without using a graphical interface or a printing application. This tool allows for convenient and efficient printing from scripts and command-line operations, which can be useful for automation and batch processing purposes.

To use lpr, you typically specify the file(s) you want to print by passing their names as arguments to the command. You can also provide options to customize the printing behavior, such as selecting a specific printer, setting the number of copies to print, and specifying page ranges.

Some common options used with lpr include -P to specify the printer destination, -n to set the number of copies, -o to provide additional options to the printing system, and -# to specify the page range.

lpr interacts with the printing system on the operating system, which commonly uses the CUPS (Common UNIX Printing System) backend. This allows lpr to work with various printers and print servers that support CUPS, enabling network printing.

Printer-specific options and configurations can often be set via the CUPS web-based interface or by editing configuration files. lpr relies on these settings to determine the default behavior and available printers.

While lpr is commonly used on Unix-like systems, the specific options and behavior may vary slightly between different distributions and versions.

Overall, lpr provides a simple yet powerful way to print files from the command line, offering flexibility and automation options for users who prefer working in the terminal environment.

List of commands for lpr:

  • lpr:tldr:4cc23 lpr: Print multiple pages per sheet.
    $ lpr -o number-up=${select} ${filename}
    try on your machine
    explain this command
  • lpr:tldr:58292 lpr: Print a file to the default printer.
    $ lpr ${filename}
    try on your machine
    explain this command
  • lpr:tldr:5ea2b lpr: Print either a single page (e.g. 2) or a range of pages (e.g. 2–16).
    $ lpr -o page-ranges=${select} ${filename}
    try on your machine
    explain this command
  • lpr:tldr:60c10 lpr: Print 2 copies.
    $ lpr -# ${2} ${filename}
    try on your machine
    explain this command
  • lpr:tldr:80565 lpr: Print double-sided either in portrait (long) or in landscape (short).
    $ lpr -o sides=${select} ${filename}
    try on your machine
    explain this command
  • lpr:tldr:8feef lpr: Print to a named printer.
    $ lpr -P ${printer} ${filename}
    try on your machine
    explain this command
  • lpr:tldr:b3dfc lpr: Set page size (more options may be available depending on setup).
    $ lpr -o media=${select} ${filename}
    try on your machine
    explain this command
tool overview