71.1 Printer Basic Commands


The basic command line tools for printing are well known to the old hands in Unix. Many of the commands begin with lp which actually stands for line printer. That brings back memories from the day.

To identify printers broadcasting their presence over the local network:

lpinfo -v

To list locally installed printers and their device URI:

lpstat -v

To add a printer queue named F108 with specified device URI and enable the queue:

lpadmin -p F108 -v https://vitellius.dcs.ktu.edu:631/printers/F108 -E

To add a device driver (PPD or Postscript Printer Driver) that you may have downloaded for the printer from the manufacturer:

lpadmin -p F108 -P ~/Downloads/IT5PPDLinux_1100010000MU/English/CUPS1.2/KOC759UX.ppd

Note the message:

lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS.

Submit a test page to the printer:

$ lpr -P F108 /usr/share/cups/data/testprint

Check the print queue:

$ lpq -P F108

Remove the printer:

$ lpadmin -x F108

The default printer is identified through the Gnome Printers Settings dialogue. This can be overridden by a user setting their own environment variable PRINTER to the name of the printer to be the default. The environment variable LPDEST overrides the PRINTER variable. With a default set we do not need to list the printer name on the command lines above.

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0