Add a printer on the command line – cups-pdf example

Suppose you need to add a printer to a computer on the command line, e.g., a server that you access via a terminal. This post outlines how to use some basic commands from the CUPS system. I will illustrate with commands for a network-connected printer and cups-pdf for printing to PDF files (~/PDF/):

 <pre class="src src-sh">sudo lpadmin -p cups-pdf -v cups-pdf:/ -E -P /usr/share/ppd/cups-pdf/CUPS-PDF.ppd

sudo lpadmin -p cups-pdf -v cups-pdf:/ -E -P /path/to/ppd ## can also use usb:/

The -E flag is crucial (Enables the printer). If a web browser is accessible from the system, you can also go to http://localhost:631 to add printers via the web browser. Almost as easy as adding it via the system-config-printer command on Ubuntu.

To check currently installed printers:

 <pre class="src src-sh">lpstat -t

UCI ICS printing

Note to self on how to set up printing at UCI ICS on a Linux. Official instructions here.

Get to Printing (under System -> Administration), Add Printer. Under Network Printer, select LPD/LPR Host or Printer (IPP did not work for me). Enter for host, and enter the printer for queue. Move forward and specify printer and driver manually.