LPR printing on command line

These days, with Linux distros such as Ubuntu, printing is quite easy. You can add and remove printers and print files just as easily (or even more so) compared to Windows or Mac. Sometimes I might just want to print from the command line. To do so, I make use of the lpr command.

To find out what printers are available, type:

 <pre class="src src-sh">lpstat -p -d <span style="color: #ff4500;">## </span><span style="color: #ff4500;">from CUPS manual</span>

This and this gives a good introduction to lpr.

 <pre class="src src-sh">lpr filename <span style="color: #ff4500;">## </span><span style="color: #ff4500;">print file using default printer</span>

lpr -P printername filename ## print file using the selected printer; see lpstat -p -d for list of printers lpr -# num filename ## to print num times

openoffice -p filename.doc ## for doc files

lpr should support txt, ps, and pdf files.

About Vinh Nguyen



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>