FreeKB - Linux Commands lpr (print a file)
Linux Commands - lpr (print a file)

Before printing, you may want to use the lpstat or lpc commands to list the available printers. You may want to also use the pr command to format a file for printing.

There are a few different commands that can be used to sent print jobs to the printer.

  • lp (Line print)
  • lpr (Line print request)
  • lpd (Line print daemon)

The lpr command can be used to print a file. In this example, the foo.txt file will be printed to the default printer the /etc/cups/cupsd.conf file.

lpr foo.txt


If you have more than one printer or more than one print queue, the lpr -P command can be used to specify a printer or queue. 

lpr -P HP-Laserjet-4000 foo.txt


For a complete list of options, view the info or man page.

man lpr
info lpr


The lpq command can be used to view and cancel print jobs in the print queue. The lprm command can be used to remove print jobs.

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 08e06 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |