LinuxCommandLibrary

lp

Print files

TLDR

Print the output of a command to the default printer (see lpstat command)

$ echo "test" | lp
copy

Print a file to the default printer
$ lp [path/to/file]
copy

Print a file to a named printer (see lpstat command)
$ lp -d [printer_name] [path/to/file]
copy

Print n copies of a file to the default printer
$ lp -n [n] [path/to/file]
copy

Print only certain pages to the default printer (print pages 1, 3-5, and 16)
$ lp -P 1,3-5,16 [path/to/file]
copy

Resume printing a job
$ lp -i [job_id] -H resume
copy

SYNOPSIS

lp [options] [file ...]

PARAMETERS

-d PRINTER
    Print to specified printer

-n COPIES
    Number of copies to print

-o OPTION=VALUE
    Set print option

-P PAGES
    Print specific pages (e.g., 1-4,7)

-q PRIORITY
    Set job priority (1-100)

-t TITLE
    Set job title

-H HOLD
    Hold job until specified time

-i JOBID
    Modify existing job

-m
    Send email on completion

-U USERNAME
    Print as specified user

DESCRIPTION

lp is the standard command to submit print jobs to printers managed by CUPS (Common Unix Printing System). It queues files for printing and provides options to control print quality, number of copies, page selection, and other print job attributes.

CAVEATS

Requires CUPS to be installed and running. Printer must be configured. Some options depend on printer capabilities. Network printers may have delays.

COMMON OPTIONS

-o sides=two-sided-long-edge - Duplex printing
-o media=A4 - Paper size
-o landscape - Landscape orientation
-o fit-to-page - Scale to fit page

SEE ALSO

lpstat(1), lpr(1), cancel(1), lpoptions(1), cupsd(8)

Copied to clipboard