lpr - Linux


The lpr command in Linux is used for printing files. It sends print jobs to a designated printer queue. lpr can be utilized to manage print jobs by specifying various printing options such as the number of copies, priority of the print job, and which printer to use. It’s particularly useful in networked environments or systems where multiple printers are set up.


The basic syntax of the lpr command is:

lpr [options] [file...]

If no file name is specified, lpr reads from the standard input.


  • -P <printer>: Specifies the printer on which the job should be printed. If omitted, the default printer is used.
  • -# <num>: Sets the number of copies to be printed (e.g., -# 4 to print four copies).
  • -o <option>: Specifies different printing options like page orientation, resolution etc. (e.g., -o landscape to print in landscape mode).
  • -h: Suppresses the printing of the burst page.
  • -r: Deletes the files once they have been printed. Use with caution.
  • -C <name>, -J <name>, -T <name>: Sets the job name as displayed in the print queue.
  • -p: Specifies that the output should be formatted with a shaded header with the date, time, job name, and page number.


  1. Print a file on the default printer:
    lpr file.txt
  2. Print a file on a specific printer:
    lpr -P office_printer file.txt
  3. Print multiple copies of a file:
    lpr -# 5 report.pdf
  4. Print a file with headers:
    lpr -p -J "Meeting Notes" notes.txt
  5. Print and then delete the file:
    lpr -r confidential.txt

Common Issues

  • Printer Not Recognized: Ensure the printer name is typed correctly and that it is configured on the system.
  • Permission Denied: lpr may require higher privileges for some operations. Running with sudo might resolve this.
  • Unsupported Options for Specific Printers: Not all printers support all options. Refer to the printer’s documentation or check possible options with lpoptions -l.


lpr can be paired with other commands for advanced printing setups:

# Find a word in a file and print lines containing that word
grep 'error' log.txt | lpr -P office_printer
  • lp: Similar to lpr, but with a different set of options and a syntax more friendly to automated scripts.
  • lpstat: Shows the current print job status on the system’s printers.
  • cupsenable and cupsdisable: Commands to enable or disable printers managed by CUPS.

For more information, refer to the Linux manual pages with man lpr or the CUPS documentation at CUPS.org.