lp
Overview
The lp
command submits files for printing or alters a pending job. It’s part of the CUPS (Common Unix Printing System) and is used to print files and manage print jobs.
Syntax
lp [options] [file(s)]
Common Options
Option | Description |
---|---|
-d printer |
Specify destination printer |
-n number |
Number of copies |
-q priority |
Job priority (1-100) |
-o option |
Set job options |
-P page-list |
Print specific pages |
-H hold |
Hold job for printing |
-t title |
Set job title |
-U username |
Specify username |
-i job-id |
Modify existing job |
Key Use Cases
- Print files
- Manage print jobs
- Set print options
- Control print queue
- Print specific pages
Examples with Explanations
Example 1: Basic Printing
lp document.pdf
Print document to default printer
Example 2: Multiple Copies
lp -n 3 document.txt
Print three copies of the document
Example 3: Specific Printer
lp -d printer_name file.pdf
Print to specified printer
Understanding Output
Standard output includes: - Job ID - Printer name - Status messages - Error messages - Queue position
Common Usage Patterns
Print with options:
lp -o sides=two-sided document.pdf
Print specific pages:
lp -P 1-5 document.pdf
Hold print job:
lp -H hold document.pdf
Performance Analysis
- Monitor queue status
- Check printer availability
- Consider file size
- Watch for errors
- Monitor job progress