Linux Comm Lpr
# Linux lpr Command
[ Linux Command Manual](#)
lpr (line printer remote) is a command used on Linux and Unix systems for printing files.
lpr sends files to the print queue, using the system's default printer or a specified printer.
lpr can be used to send data to a local or remote host for processing.
### Syntax
lpr [file...]
**Common Options:**
* `-P `: Specify the printer to use. If not specified, the system default printer is used.
* `-# `: Specify the number of copies to print.
* `-o `: Specify print options, such as duplex printing, page ranges, etc.
* `-h`: Do not print the banner page.
* `-C `: Specify the class of the job.
* `-J `: Specify the job name.
* `-T `: Specify the job title.
### Examples
Print a file:
lpr myfile.txt
Print to a specific printer:
lpr -P myprinter myfile.txt
Print multiple copies:
lpr -# 3 myfile.txt
Do not print the banner page:
lpr -h myfile.txt
Specify print options (e.g., duplex printing):
lpr -o sides=two-sided-long-edge myfile.txt
Duplex printing:
lpr -o sides=two-sided-long-edge myfile.txt
Specify page range:
lpr -o page-ranges=1-5 myfile.pdf
You can print multiple files at once by listing the filenames separated by spaces:
lpr file1.txt file2.txt file3.txt
Print all files in a directory:
lpr -r directory
Use the lpstat command to view the status of the current print queue:
lpstat -o
Cancel a print job:
cancel job_number
The cancel command is used to cancel a job in the print queue, where job_number is the job number.
For more advanced features, refer to the system's man page:
man lpr
[ Linux Command Manual](#)
YouTip