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

Linux
Author

Vinh Nguyen

Published

May 12, 2011

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/):

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:

lpstat -t